Hi all,

I am creating a contract database, and in the bit I am at now, the users are being created and they also need to be connected to the corporations that have already been created.

The form I have is i am using the same form to add and then if needed edit the users, and have managed to successfully create the checkboxes to display to be able to add the users with the code below:

(I know I need to update to mysqli, which I will do once i get this working, as need ot anyway as the servers are being changed too)

Code:
<label class="myCheckbox">Corporations</label>
<?php
 $q="select * from Corporations";
 $result = mysql_query($q) or die(mysql_error());
 while($row = mysql_fetch_assoc($result)) {
    echo <<<EOL
 <div class="myCheckbox">
 <input type="checkbox" name="name[]" value="{$row['ID']}" /> <span>{$row['Name']}</span><br />
 </div>
EOL;
} ?>
The checkboxes display fine on the page, but what I need to do now is allow the admin person to select the corporations they want to attach to the user they are adding in.

How do I get these checkbox values into the field name 'Corporations' in the Useradmin table as an array. Suppose start with that first.

Code:
 
if(isset($_POST['btnsubmit']))
{
$sr=$_POST['srno1'];
if ($flag==0)
{
$userFirstName=mysql_real_escape_string($_POST['firstName']);
$userSurName=mysql_real_escape_string($_POST['surName']);
$userUserName=mysql_real_escape_string($_POST['userName']);
$userPassWord=mysql_real_escape_string($_POST['pWord']);
$userActive=$_POST['Active'];  
$userSuperAdmin=mysql_real_escape_string($_POST['superAdmin']);
$userCorporationName=????????????;
$q24=mysql_query("update UserAdmin set First Name='$userFirstName', Last Name='$userSurName', Username='$userUserNam', Password='$userPassWord', Active='$userActive', Super Admin='$userSuperAdmin', Corporations='??????????', Date='$dt2' where ID=$sr") or die (mysql_error());
$flag=1;
$update="1";
}
else
{
$userFirstName=mysql_real_escape_string($_POST['firstName']);
$userSurName=mysql_real_escape_string($_POST['surName']);
$userUserName=mysql_real_escape_string($_POST['userName']);
$userPassWord=mysql_real_escape_string($_POST['pWord']);
$userActive=$_POST['Active'];  
$userSuperAdmin=mysql_real_escape_string($_POST['superAdmin']);
$userCorporationName=????????????;
        
$q=mysql_query("insert into UserAdmin (First Name, Last Name, Username, Password, Active, Super Admin, Corporations, Date) values('$userFirstName','$userSurName','$userUserName','userPassWord','userActive','$userCorporationName')") or die (mysql_error());
$update=1;
}
}