OK so basically I have a HTML checkbox:
<input type="checkbox" name="mailinglist" />
This checkbox is on a user sign up form and this determines if they want to subscribe to the mailing list. I just want this the return as a 1 or 0 (boolean) inside the PHP. As you can see I am using POST:
<form action="process-create.php" method="POST">
And in my PHP it is receiving that post like this:
$mailinglist = $_POST['mailinglist'];
This all looks fine up to here. Now I want to input it into a database (with a boolean value). This is the code that inputs it into the database:
$data = array('username'=>$username, 'firstname'=>$firstname, 'lastname' => $lastname, 'mailing_list'=>$mailinglist, 'email'=>$email );
mysql_insert('users', $data);
Even when I tick the box it still says 0 in the databse. As you can see:
USERNAME FIRSTNAME LASTNAME MAILING LIST EMAIL
odixon Oliver Dixon 0 *********
Any suggestions? If you want more samples of code I would be happy to give them (if it would help).