andrew0136 0 Newbie Poster

Look, Im pretty new to php and sql and need some help.
Im trying to make a database that can store contact details of potential customers that are interested in a specific category. My problem is inserting muliple checkbox data into the database.
My PHP and form (all in AddContact.php) looks like this:
Please help!!

<?php
require_once('inc/global.php');
include('inc/auth.php');

if ($_POST['submit'] == 'Submit'){
mysql_select_db($dbname, $db);
$sql = "INSERT INTO aantiqueContacts (CustName, CustEmail, CustPhone, CustWebsite, CustCats) VALUES (
    '".addslashes($_POST['CustName'])."', 
    '".addslashes($_POST['CustEmail'])."', 
    '".addslashes($_POST['CustPhone'])."', 
    '".addslashes($_POST['CustWebsite'])."',
    '".addslashes($_POST['CustCats'])."')";
mysql_query($sql, $db) or die(mysql_error());
}
?>
<?php
require_once('inc/global.php');
mysql_select_db($dbname, $db);
$sql = "SELECT * FROM `aantiqueCat` ORDER BY `aantiqueCat`.`catName` ASC";
$result = mysql_query($sql, $db) or die(mysql_error());
$listCats = mysql_fetch_assoc($result);
?>




<table>
    <form method="post" action="AddContact.php">
    <tr>
        <td><label for="CustName">Name</label>
        <td><input type="text" name="CustName" placeholder="Name" /></td>
    </tr>
    <tr>
        <td><label for="CustEmail">Email</label></td>
        <td><input type="text" name="CustEmail" placeholder="Email" /></td>
    </tr>
    <tr>
        <td><label for="CustPhone">Phone No.</label></td>
        <td><input type="text" name="CustPhone" placeholder="Include Area Code" /></td>
    </tr>
    <tr>
        <td><label for="CustWebsite">Website</label></td>
        <td><input type="text" name="CustWebsite" placeholder="eg. www.yoursite.co.uk" /></td>
    </tr>

    <tr>
        <td><label for="CustCats">Categories:<br />Please check all that apply.</label></td>
        <td>
        <?php do { ?>
        <input type="checkbox" value="<?php echo $listCats['catName'];?>" name="CustCats"><?php echo $listCats['catName'];?><br />  
        <?php } while($listCats = mysql_fetch_assoc($result)); ?>
</td>
    </tr>
    <tr>
        <td></td>
        <td><input type="submit" name="submit" value="Submit" /></td>
    </tr>
</form>
</table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.