LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   $HTTP_POST_VARS doesn't accept disabled input fields (https://www.linuxquestions.org/questions/programming-9/%24http_post_vars-doesnt-accept-disabled-input-fields-353741/)

xemous 08-16-2005 05:16 AM

$HTTP_POST_VARS doesn't accept disabled input fields
 
Code:

<input type='text' name='total' size='5' value='22' disabled>
If I use a

$Total = $HTTP_POST_VARS['total'];

in my php script, I get a:

Notice: Undefined index: total in C:\Server\Apache2\htdocs\bloodaxe\checkout.php on line 3

But if I remove the disabled from the input field, it works ok, but then the field is enable to be tampered with again !

How can I get it to accept the variable while still keeping the field disabled?

Cheers !

phil.d.g 08-16-2005 05:23 AM

http://www.faqs.org/docs/htmltut/for..._DISABLED.html

In the above article it seems what you are trying to is not possible and it is not a limitimation of PHP, rather HTML. Instead of disabling the input you need to make it readonly.

I have not tested this, its just my interpretation of the above article, let us know if it works or not.

xemous 08-16-2005 05:34 AM

It worked, cheers mate.

phil.d.g 08-16-2005 05:49 AM

excellent,

On a side note you could use CSS to make the textbox appear disabled: grey background, etc if you wish.


All times are GMT -5. The time now is 03:38 AM.