Check boxes

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
brookside
Forum Commoner
Posts: 30
Joined: Tue Mar 02, 2004 8:15 pm

Check boxes

Post by brookside »

I have a php page set up to add members to a MySQL Database. I can retrieve all the information from the form except the information in the check boxes. How do I know whether or not a check box has been checked? Can I do this in PHP or do I need to use javascript? I would like to use php if at all possible. Any suggestions or help is appreciated.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

your best bet would create the data in the check boxes into an array. With the data as a array, you can process several items at once
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

Checkboxes are sort of a "true/false" thing. They return the value if they are checked, but are not even set if they are not checked.

<input type='checkbox' name="Foo' value='Bash'>

on return this will return $_POST['Foo'] = 'Bash' or if not checked, $_POST[''Foo'] will not be set.

Is that what you needed?
Post Reply