471,583 Members | 1,467 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,583 software developers and data experts.

carry over info from one .html page to another (overcome statelessness?)

2
Hi!

this must be a stupid question, but bare with me - I just started learning html!

My problem:
I have several html pages that use forms to collect user input.
On each page, submitting the data activates a cgi script that saves it to my server and then forwards the user to another html page.

I would like to carry a hidden variable (i.e., the user ID that someone entered on the first page) forward through all html pages, so that I can later link all the data submitted by the same user on the different pages. I do not want the user to input their id into a textbox on every page.

I realize that html is stateless, and that I can overcome this by having all pages be generated by a cgi script. However, what do I do if that is not a good option for me (i.e., after the cgi script is executed, the user should be forwarded to an html page, which only executes a new cgi once the data on that page gets submitted). I also do not want to /cannot use cookies for this.

Is there any way? Please help!

Thanks a lot,

as_sass
Oct 4 '07 #1
4 2584
Why don't you just use PHP, thats probably the best way
Oct 4 '07 #2
drhowarddrfine
7,435 Expert 4TB
Why don't you just use PHP, thats probably the best way
Perhaps he is. He's using CGI which can be used with any programming language.

Using a hidden 'id' as you described is a frequent solution, as are cookies if possible. Another possibility is adding a user id onto the url when forms are submitted or the links.
Oct 4 '07 #3
sass
2
Thanks for the help!
I am not using PHP, and I was trying to avoid cookies.

However, I think I figured something out based on your suggestion:

Visitors will enter their id into a form field on the first page, and from thereon out this will get appended to the URL (e.g., www.domain.com/linkhere.html?12345).
As far as I figured out, the linkhere.html should still work even if I append numbers to it with a question mark, right?

then I can save the referer using a cgi-script and extract the id from it.
Now I just need to figure out how to extract the last five characters of the referer.
Any ideas?

Thanks SO much!

as
Oct 5 '07 #4
drhowarddrfine
7,435 Expert 4TB
A problem could occur with the .html extension. Your server will probably see the .html extension and look for a html page but ignore the rest. But this should all be handled with your server side script anyway and can automatically insert the 'user id' rather than make the viewer do that. The submitted for would be sent to the server side script to be handle and shouldn't have a .html extension anyway.
Oct 5 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by matt | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.