PDA

View Full Version : Form with check boxes?



akphotography
April 10th, 2007, 04:54 PM
I want to make a form where the user can check boxes...and fill out a mini form....how do i make the check boxes and with PHP how do i keep track of which ones they have checked?

evildrummer
April 10th, 2007, 05:13 PM
same with text boxes, the id's and names give you access to each one but for each text box you also have to give a value, I normally give each value a digit then in the next PHP page work out what the digit value means.

borrob
April 11th, 2007, 02:21 AM
here is an example:
here is how you create a checkbox:

<form action="main.php" method="POST" target="" name="relations_form">

<input type="checkbox" value="is_client" name="is_client" <?php if( $relation_row->is_client == 1 ) echo "CHECKED"; ?> > client </input>
</form>


now for the posted variable:

if( isSet( $_POST['is_client'] ) )
{
$relation_row->is_client = 1;
}
else
{
$relation_row->is_client = 0;
}

oke that 's it have fun...