Jump to content

Archived

This topic is now archived and is closed to further replies.

Schunkeffect

Disabled <input type> won't pass variable

Recommended Posts

Well I know there has been a lot of talk on this forum about passing variables via the URL, and session variables, etc ... I have searched for my answer but was unable to find it. It's pretty basic, but I just can't figure it out.

What I have is a form with some fields that are disabled. Essentially, a user would click on a URL (with embedded variables) and a form would them show up that was paritally filled out (with the embedded variables in the disabled fields). If I submit this form to a .php page that runs a query, the disabled fields are NOT passed to the .php page that runs the Query. However, if I leave these fields as input type (AKA not disabled) the variables are passed to the next page.

I am calling these variables using $_GET["variable"] on the page that runs the Query. Do any of you know why I can't pass the variables if the field is disabled??

Thanks in advance,

Nate

Share this post


Link to post
Share on other sites
If a field is disbled it won't pass the value back -- that's part of HTML. If you want to leave a the field disabled and still be able to pass the value, you should use a hidden field.

You really should change the method to POST, it makes your data a little more secure. When you use GET, a malicous user could see what you're passing back and design a URL that looks like it came from your form, but really didn't. Of course, they can still do that with the POST method, but they have to read the source to find what you're sending.

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.