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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Variables Between Forms

Status
Not open for further replies.

iaresean

Programmer
Mar 24, 2003
570
ZA
Hello All,

I am currently passing information between forms using the html links. Like so:
<A HREF=&quot;main.cgi?menuoption=1&otheroption=2&quot;>Click Me</A>
I want to know if there is a better way of passing this information so that the user can't see this information.

I am fully aware of using forms with hidden fields. But I would rather use that method as a last resort.

Any help in this matter is greatly appreciated.
 
Check out CGI::Session if you are using perl.

You want session management. This allows you to set a session ID in 1 of 3 ways, URL, cookie or hidden field.

This token then references user data on the server and you do not have to pass it around all over the place.

PHP has an equivalant as well I imagine.
 
Thank you for your response siberian.

Yes I am familiar with CGI::Session, my only concern is for those people that disable cookies. If they have disabled cookies they won't be able to get passed my first page. Any further advice?
 
If you're on an Apache web server, you can use mod_rewrite to provide alternative URLs for cgi script pages - e.g. you could get, say &quot;mysite.com/option/1/2&quot; to map to &quot;mysite.com/cgi-bin/main.cgi?menuoption=1&otheroption=2&quot;. Might be one avenue to explore.

Frankly I wouldn't worry too much about it - do you ever look at the ugly URL on a Tek Tips page?

-- Chris Hunt
 
You did not read my post, I specifically stated :

'You want session management. This allows you to set a session ID in 1 of 3 ways, URL, cookie or hidden field.'

The session iD does not have to be a cookie, you can use a hidden field or a URL string.
 
Yes siberian,

But isn't the session id maintained via a cookie?
Excuse me if I am wrong. I am very new to all of this.
 
A session ID can be maintained in THREE WAYS

1) A cookie as you mention
2) In the URL, amazon.com does this, check it out. Pay attention to the URL
3) In a hidden form field.

There is no magic to a session ID, it can be handled in a number of different ways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top