Page 1 of 1

check box

Posted: Tue Aug 08, 2006 1:53 am
by shiranwas
hi,,
in my html page there is a check box

<input type="checkbox" name="chkRejected" value="CHECKED">

when i get the value of this as follows it gives me the value even its checked or not
how i get the value if its checked only or do a function if its checked only

$reject=$_POST['chkRejected'];

pls help me

shiran

Posted: Tue Aug 08, 2006 1:59 am
by feyd
unless you have some bizarre page logic, I don't see how the checkbox would be submitted if it wasn't checked. That's just not the behavior most, if not all, browsers do for unchecked ones.

Posted: Tue Aug 08, 2006 2:01 am
by webproject
I don't see why it shouldn't work, i checked it 2 min ago, and it is works, maybe your HTML code is wrong.

Posted: Tue Aug 08, 2006 2:06 am
by shiranwas
thanks it woks now there was a html error as u said

Posted: Tue Aug 08, 2006 2:08 am
by webproject
I knew it, cause, a value won't be sent unless the user checked it.