check box

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

check box

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
webproject
Forum Newbie
Posts: 7
Joined: Mon Aug 07, 2006 4:07 pm

Post 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.
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

Post by shiranwas »

thanks it woks now there was a html error as u said
webproject
Forum Newbie
Posts: 7
Joined: Mon Aug 07, 2006 4:07 pm

Post by webproject »

I knew it, cause, a value won't be sent unless the user checked it.
Post Reply