options for passing variables between forms

liunx

Guest
As I understand it, you can pass information between forms in HTML using HIDDEN INPUT fields with POST, as part of an HREF string, or as cookies. I have done the first 2 options with success. However from what I have seen/read, a) cookies are problematic in the event the user has cookies <br />
set to disabled, b) using variables in the HREF string makes those variables and their values visible to the user on the address bar. Using HIDDEN INPUT fields sounds good, but I happen to like using a link, rather than a POST submit button on certain areas of my website.<br />
<br />
So my question is: if I am passing userid/password as I move from form to form how can I hide them, yet give me the option of using buttons or links? Are session cookies my only option relative to having the button or link flexibility.<br />
<br />
Thanks in advance for your help!<!--content-->While there are much better ways of handling session management, you can use hidden form variables and links at the same time. The problem is that you'd have to have a form for each link on the page, which could get ugly in a hurry. This would be done by having the link call some JavaScript to submit the form, such as:<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:document.formname.submit();">link</a><br />
<br />
Using JavaScript in the URL isn't a W3C standard, and it could also be placed in the onclick event handler if you're concerned about it.<br />
<br />
Personally, I use cookies for my session management. Most of the sites I work on cater to technology savvy people, so having cookies disabled isn't an issue. Even if someone doesn't use cookies, I let them know that they need to turn them on before they can get in. I don't know anyone who is a "cookie-phobe" myself, but I've heard they're still lurking out there.<!--content-->Sceiron -<br />
Thanks so much for your insight. I spent a fair amount of time reading about session cookies, and trying a practical example. I will have to look to see how I can identify if the current user's browser supports session cookies, unless you have something handy to pass along. <br />
<br />
Then I tried your idea of passing a form via an href. It worked great! Fortunately I don't have too many links so it would be manageable. One last question - you mentioned that using the javascript in the href was not 'W3C standard', and that an onclick might be safer. If you have some experience with the W3C community, what might occur if something has not been standardized? If you were me, which one would you choose?<br />
<br />
Again thanks so much for your time and effort. It was much appreciated!<br />
<br />
Laura<!--content-->I try to stick with the published standards where possible, though there are a few areas I'm rusty on myself (there's a lot of maretial to remember, hehe). The more "standard" way to do it would be:<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="document.formname.submit();">link</a><br />
<br />
And an even better way would be to use a <span> tag with a CSS class applied to it to make it look like a link, using onclick to submit run the submit code. As for what happens if you don't use W3C standard, that depends on the browser.<!--content-->
 
Back
Top