Re: [PHP] checkbox doesn't pass?

2002-04-04 Thread Philip Olson


Unchecked checkboxes pass no values, that's how 
it works.  It's either set or not.  Default value 
for a checkbox is 'on' although you can change
that.  isset() will work fine.

Regards,
Philip




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkbox doesn't pass?

2002-04-04 Thread Chris Boget

> >But IF I still want  to use $HTTP_POST_VARS, what then? What about the
> >warning when checkbox is not checked?
> I use empty() to check the for the existence of checkbox variables.

You can also use isset();

Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] checkbox doesn't pass?

2002-04-04 Thread Matt Schroebel

You should use $HTTP_POST_VARS (or $_POST) all of the time.  There's security risks in 
using register_globals. It's not risky in all cases. But register_globals will allow 
arbitrary variables to be added to into the name space of your script by simply 
putting them on the uri.  Code not expecting such input, and expecting variables not 
to exist unless the script set them may behave unexpectedly.

The reason the variable is not set is that the checkbox isn't checked.  You can test 
the variable with isset(), or empty() before you use it so you don't get the warning.

To learn what your script it seeing when you submit the page, do a:
foreach ($HTTP_POST_VARS as $key => $value) {
echo "Key: $key Value: $value\n";
}
at the top of your action handler script, and watch the variables come in when you 
check or not check the checkboxes.  Once you understand that, then write the code to 
handle the situation.

> -Original Message-
> From: savaidis [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, April 04, 2002 10:17 AM
> Thank you both for help and info! You were both very fast :)
> I didn't know I could  not to use $HTTP_POST_VARS . Now it 
> works all right.
> But IF I still want  to use $HTTP_POST_VARS, what then? What about the
> warning when checkbox is not checked?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] checkbox doesn't pass?

2002-04-04 Thread Eugene Mah

At 18:17 04-04-02 +0300, savaidis wrote:

>But IF I still want  to use $HTTP_POST_VARS, what then? What about the
>warning when checkbox is not checked?
I use empty() to check the for the existence of checkbox variables.


--
-
Eugene Mah, M.Sc., DABR   [EMAIL PROTECTED]
Medical Physicist/Misplaced Canuck[EMAIL PROTECTED]
Department of Radiology   "For I am a Bear of Very Little
Medical University of South Carolina   Brain, and long words Bother
Charleston, South Carolina me."   Winnie the Pooh
http://home.netcom.com/~eugenem/
PGP KeyID = 0x1F9779FD, 0x319393F4
PGP keys available on request ICQ 3113529 O-
-


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] checkbox doesn't pass?

2002-04-04 Thread savaidis

Thank you both for help and info! You were both very fast :)
I didn't know I could  not to use $HTTP_POST_VARS . Now it works all right.
But IF I still want  to use $HTTP_POST_VARS, what then? What about the
warning when checkbox is not checked?

Thanks

Makis


> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 04, 2002 5:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] checkbox doesn't pass?
>
>
> On Thursday 04 April 2002 20:46, [EMAIL PROTECTED] wrote:
>
> > why do you use $HTTP_POST_VARS? Do I miss something?
>
> For security reasons.
>
> Manual > Security
>
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> /*
> Above all things, reverence yourself.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkbox doesn't pass?

2002-04-04 Thread Jason Wong

On Thursday 04 April 2002 20:46, [EMAIL PROTECTED] wrote:

> why do you use $HTTP_POST_VARS? Do I miss something?

For security reasons.

Manual > Security



-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Above all things, reverence yourself.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] checkbox doesn't pass?

2002-04-04 Thread heinisch

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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] checkbox doesn't pass?

2002-04-04 Thread savaidis


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?

What's wrong?

Makis Savaidis
Thessaloniki
Greece



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php