Jump to content


Photo

Disabled <input type> won't pass variable


  • Please log in to reply
1 reply to this topic

#1 Schunkeffect

Schunkeffect
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 28 March 2006 - 02:44 PM

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

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 28 March 2006 - 03:25 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users