Check Box Array Problem
Posted: Tue Nov 25, 2003 8:39 pm
I'm having trouble getting my dynamic check boxes to become an array which I will use to update an sql database.
Here is the form code:
Here is the insert into database part:
There error I am getting is
Any ideas?
Thanks
Here is the form code:
Code: Select all
<input name="selectedfile[]" type="checkbox" value="<?php echo $row_filelist['ID']; ?>">Code: Select all
<?php
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "addfiles")) {
for( $i = 0; $i < sizeof( $selectedfile ); $i++ ){
$insertSQL = sprintf("INSERT INTO filetopage (page, file) VALUES (%s, %s)",
GetSQLValueString($HTTP_POST_VARS['deletedpageid'], "int"),
GetSQLValueString($HTTP_POST_VARS['selectedfile[$i]'], "int"));
mysql_select_db($database_cms, $cms);
$Result1 = mysql_query($insertSQL, $cms) or die(mysql_error());
}
}
?>I do not understand why it gives this error. I tested it prior to adding the database info, by having it echo the results of the array, and it worked perfectly. It showed me all the values stored in the array.Column 'file' cannot be null
Any ideas?
Thanks