I have the following php code for submitting the form to the database the only problem is with the checkboxes ... on submitting the form this shows up
Warning: join() [function.join]: Invalid arguments passed in /srv/disk6/1662822/www/website.co.nf/connect-mysql.php on line 16
<?php
$host="host.com" ;
$username="1662822_db1" ;
$password="awesomepassword" ;
$db_name="1662822_db1" ;
$tbl_name="courses" ;
$dbcon = mysqli_connect("$host","$username","$password","$db_name") ;
if (!$dbcon) {
die('error connecting to database'); }
echo 'Courses successfully registerd , ' ;
// escape variables for security
$studentid = mysqli_real_escape_string($dbcon, $_POST['studentid']); echo $studentid;
**$ckb = join (', ', $_POST['ckb']);**
**$sql="INSERT INTO courses (studentid, ckb)
VALUES ('$studentid', '$ckb')";**
if (!mysqli_query($dbcon,$sql)) {
die('Error: ' . mysqli_error($dbcon));
}
echo " Thank you for using IME Virtual Registeration ";
mysqli_close($dbcon);
?>
The error is Warning: join() [function.join]: Invalid arguments passed in /srv/disk6/1662822/www/website.com/connect-mysql.php on line 16
I understand its something to do with join function (obviously) but I don't understand what it is...
HTML code for checkboxes
<input type="checkbox" name="ckb" value="strenthofmaterials";>
<label for="StrengthofMaterials"> Strength Of Materials </label>
<input type="checkbox" name="ckb" value="dynamics";>
<label for="StrengthofMaterials"> dynamics </label>
it goes on for all other choices with only changing the value of each checkbox
another piece of information , the ckb field in mysql database type in tinyint with a default value of 0 ...and I'm guessing its not the type I'm looking for ..?