Checkbox Submission

what i am trying to accomplish is i have a List of records coming in from a MySQL database and i have check-boxes next to them i want to be able to check the boxes to let users know rive seen the Submissions, i,m getting “failed to insert” can anyone help be dig into what is the problem… i can post the Entire project if needed.


 Button :    <input type="checkbox" name="check[]" id="check" value="1">
-----------------------------------------------------------------
 <?php  
    if(isset($_POST['sub']))  
    {  
    $host="localhost";//host name  
    $username="root"; //database username  
    $word="goobers";//database word  
    $db_name="sudb";//database name  
    $tbl_name="timesheet"; //table name  
    $con=mysqli_connect("$host", "$username", "$word","$db_name")or die("cannot connect");//connection string  
    $checkbox1=$_POST['techno'];  
    $chk="";  
    foreach($checkbox1 as $chk1)  
       {  
          $chk .= $chk1.",";  
       }  
    $in_ch=mysqli_query($con,"insert into timesheet(viewed) values ('$chk')");  
    if($in_ch==1)  
       {  
          echo'<script>alert("Inserted Successfully")</script>';  
       }  
    else  
       {  
          echo'<script>alert("Failed To Insert")</script>';  
       }  
    }  
    ?>  


I.m assuming

 
    $in_ch=mysqli_query($con,"insert into timesheet(viewed) values ('$chk')");  

means table timesheet column “viewed” right ?

and , uhh one issue "answering my own question is this,


 Button :    <input type="checkbox" name="check[]" id="check" value="1">
-----------------------------------------------------------------
 
    $checkbox1=$_POST['check'];     instead of   ::    $checkbox1=$_POST['Techno']; 
    

Let me try that

Sponsor our Newsletter | Privacy Policy | Terms of Service