Welcome to Questionaries, where you can ask questions and receive answers from other members of the community.

Let us know at info@questionaries.org

About creating checkbox

5 like 0 dislike
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>';
     }  
===================================
asked 2 years ago by eagle09 (95,490 points)

Your answer

Email me at this address if my answer is selected or commented on:
Privacy: Your email address will only be used for sending these notifications.

0 Answers

Related questions

7 like 0 dislike
0 answers
asked 2 years ago by eagle09 (95,490 points)
6 like 0 dislike
0 answers
5 like 0 dislike
0 answers
10 like 0 dislike
0 answers
7 like 0 dislike
0 answers
asked 1 year ago by daneim (127,080 points)