mardi 16 juin 2015

Keep the checkbox checked after submitting the form

i have made a form in which user checks the check box..and after selecting it click on a OK button and its value goes on another page... I just want a checked after i hit the OK button..its type is submit though..I just want a simple solution in java script, j query or ajax but not in PHP .. Kindly please help me..Thanks for your help in advance... i have tried the php code but its giving errors and its making everything so complicated, i don't wanna do complicated...

     <?php
     include 'connection.php';
     $sql="SELECT * FROM `tbl`";
     $query=mysqli_query($connect,$sql);

        echo "<table border='2px'>
  <thead>
  <th>ID</th>
  <th>Title</th>
  <th>Name</th>
  <th>Doing</th>
  <th>Done</th>
   </thead>";
     echo "<form method='POST'>";
    echo "<tr>";
    while($res=mysqli_fetch_assoc($query)){
    $id=$res['id'];

          echo" <td>{$res['id']}</td>
           <td>{$res['title']}</td>
           <td>{$res['name']}</td>
    <td><input type='checkbox' name='doing[]'
    value='".$res['id'].$res['title'].$res['name']."'></td>

           <td><input type='checkbox' name='done[]'  
     value='".$res['id'].$res['title'].$res['name']."'></td>
           </tr>"
           ;}
           echo "</table>";
           echo "<input type='submit' value='OK' name='btn'>";
           echo "</form>";
      ?>




Aucun commentaire:

Enregistrer un commentaire