Jump to content

Disabled <input type> won't pass variable


Schunkeffect

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
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.