Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Processing problem

Status
Not open for further replies.

marct

Programmer
Apr 6, 1999
32
0
0
US
Hi,

I have an application in which the user chooses a date from one page, and, after clicking a button, an asp opens (onSubmit of the form) to process the form and place the information in cookies. Then the asp redirects to my results page. The results page processes the cookies, determines the right SQL statement, queries a SQL database, and builds a table based on the results.

All this works great. Now, however, I need to add two buttons - "Next Hour" and "Previous Hour". The query returns one hour worth of data, and they want to be able to go to the next hour or the previous hour and reload the page. I cannot for the life of me figure out how to do this. Can anyone tell me the right things I should be looking at to make this work? I am currently using vbscript on both the client and the server scripts, but am open to javascript on the client side.

Any help would be greatly appreciated, and I apologize for the long post, but I wanted to be thorough.

Thanks in advance,

Marc Tower [sig][/sig]
 
Marc,

Basically, it seems as though you need a pointer.

On the submit page (I'll assume you have a form or some way to submit with GET or POST but we'll use GET) submit a variable to the next page in the form of "submit.asp?pointer=0"

On the submit page have as part of your asp "Request.QueryString("pointer")". This value will tell the page which hour to show. When you resubmit the page increment or decrement the value a'la "submit.asp?pointer=-1" for previous hour or pointer=1 for next hour. Use 0 as a relative value so that a submit can have pointer=-15 for 15 hours in the past.

As for writing the next and previous buttons (in ASP VBScript)...
Code:
response.write &quot;<form method='GET' action='submit.asp?pointer=&quot; & pointer+1 & &quot;'><input type=submit value='Next'></form>&quot;

response.write &quot;<form method='GET' action='submit.asp?pointer=&quot; & pointer-1 & &quot;'><input type=submit value='Previous'></form>&quot;

Now, of course, you will have to integrate the ideas with your existing code but I hope this helps get you started. If on the other hand this is totally useless to you please let me know.

Rob
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top