I am trying to create a datagrid with a checkbox at the top of each column to allow the user to turn a column off or on.
I then want to save the options to a file so that once the user sets the columnes, it will allow the user to come back to the screen without having to select the options again.
What I am doing is storing the the options in a text string,
String 00110011
0 0 1 1 0 0 1 1
NAME DATE A B C D E F
Trying to demonstrate above that the user has selected the columns with 1 above them, but I cannot get a check box to return a value.
PHP Code:
===============================================
if(isset($_POST["console"])){
$console=implode("",$_POST["console"]);
$sql='UPDATE tbl_staff SET interface ="'.$console.'" WHERE staff_id='.$_SESSION['staff_id'];
$result = mysql_query($sql, $link);
if (!$result) {
echo 'DB Error, could not query the database MySQL Error: '.mysql_error();
exit;
}
$_SESSION['interface'] = $console;
echo $console;
======================================================
PHP Code:
======================================================
for ($x=1;$x<strlen($_SESSION['interface']);$x++){
$str_header=$str_header.'<td><input type="checkbox" name="console[]" value="'.$col[$x][1].'" checked="'.$col[$x][0].'" /></td>';
}
===================================
Your answer