too long

I'm trying to add a checkbox to the table column but can't figure out how to manage it.

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> 

?>

The code works fine. It shows 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.

This is the way to do it :

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>';

and also, add curly braces to your while loop {}.

<?php
  while ( $row = mysqli_fetch_array($result) ) {
      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>';    
      echo '</tr>';
 }
?>
 </table> 
$id=$row['id'];
$str = <<<EOD
<table>
<tr>
    <td>
        <input type="checkbox" value ='' name='todelete[]' /> $id 
    </td>
</tr>
</table>
EOD;
echo $str;

Here is more example on "Heredoc string quoting example"
http://php.net/manual/en/language.types.string.php

You can show input type='checkbox' in php in two ways :

CASE 1 : instead close the php tag and put the html code

<?php
  while ( $row = mysqli_fetch_array($result) )
  {
    ?>
    <tr>
      <td><input type="checkbox" value ="''" name="todelete[]" />
          <?php echo $row['id']; ?> </td>
      <td><?php echo $row['title']; ?></td>
      <td><?php echo $row['author_last']; ?></td>
      <td><?php echo $row['author_first']; ?></td>
      <td><?php echo $row['format']; ?></td>
      <td><?php echo $row['price']; ?></td>
      <td><?php echo $row['isbncode']; ?></td>
   </tr>
 </table> 
<?php 
}
?>

CASE 2 : Put your html code in php with the of echo

<?php
  while ( $row = mysqli_fetch_array($result) ) {
      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>';    
      echo '</tr>';
 }
?>