dimanche 21 février 2016

How to add checkboxes inside a column table using echo in PHP (new to coding)

I'm trying to add a checkbox to a table column but can't figure it out. Here is my html and php code.

<table  border="1">
  <tr>
    <th>Select</th>
    <th>ID</th>
    <th>Title</th>
    <th>Author's Last Name</th> 
    <th>Author's First Name</th>
    <th>Format</th>
    <th>Price</th>
    <th>ISBN Code</th>
  </tr>

<?php
  while ( $row = mysqli_fetch_array($result) )

  echo '<tr>';
  echo '<td>' . <input type="checkbox" value ="''" name="todelete[]" /> . $row['id'] . '</td><td>' . $row['title'] . '</td><td>' . $row['author_last'] . '</td><td>' . $row['author_first'] . '</td><td>' . $row['format'] . '</td><td>' . $row['price'] . '</td><td>' . $row['isbncode'] . '</td>';

   </tr>
 </table> 

?>

/* My code works fine. It show everything in the table perfectly. I just can't seem to type the "input type checkbox" in the echo statement. When I attempt to add the input the code stops working. */

Please help!




Aucun commentaire:

Enregistrer un commentaire