Re: checkbox checked?

From: Date: Sun, 22 Oct 2000 01:23:53 +0000
Subject: Re: checkbox checked?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21618@lists.php.net to get a copy of this message
Grant Walters wrote: > > How would I check if a checkbox is checked? I have a form that will > > require the one checkbox in it, to be checked. I have learned how to > > validate mail, names, ETC, but I have run into a wall on this one. > > I believe that PHP (3 anyway) doesn't set the variable in HTTP_POST_VARS for > unchecked check boxes so... > > If you have > > <input type="checkbox" name="Contact_Requested" > value="True"> Please contact > me as soon as possible regarding this matter > > In a checked situation there will be a variable called Contact_Requested set > (or HTTP_POST_VARS['Contact_Requested']) > > If it is unchecked before the form is submitted then it won't be there. > > Regards > > Grant Walters > Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND > Telephone: +64 4 4765175, CellPhone 025488265 I think I should of written more informative post. The form passes the variables to a php script called join.php by<form action="join.php" method="post"> . join.php checks the db to see if their email address or their username is in it.if not it mail them the username and password they chose. I also need to make sure they checked the accept $checkbox. I was thinking along the line of if ($checkbox <=0); echo "you must accept the rules, before you can join"; else I don't know if <=0 will work. Gary -- The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.Jean Baudrillard (1929), French semiologist.

« previous php.general (#21618) next »