Re: checkbox doesn't pass?
| From: | heinisch at creaction dot de | Date: | Thu, 04 Apr 2002 12:46:30 +0000 |
| Subject: | Re: checkbox doesn't pass? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91509@lists.php.net to get a copy of this message | ||
At 04.04.2002 15:23, you wrote:
I have a html form with some "text" (T1) and "checkbox" (C1) fields to pass it to a php script. Accessing "text" fields has no problem. There is a problem when I use $C1=$HTTP_POST_VARS['C1'] to take the value of C1 (ON) If it is not checked, then it is not set at all. (??why??) So I use : if (!isset($C1)) { $C1="0" } but still I get an warning that C1 is not set, on my screen. That happens before the use of isset function. How can I susspent this warning message? Makis,why do you use $HTTP_POST_VARS? Do I miss something? if you have a form and send it, the vars have the same names as in your form, will say if your checkbox name="foo" value="someval" will be transmitted, then in the following page there´s a var named $foo. and the value will be "someval" if the box is checked, otherwise there´s no (or NULL or FALSE ???) value in it. I personally prefer put checkbox vars (if there are several) in an array f.e. $foo[] In the following page I just scan the array and if there´s a value in a field thats fine. HTH Oliver