0

I am using this code to add a checkbox to each row of a table. But, the checkbox shows up as a textbox with the ClientID in it:

while ($row = mysqli_fetch_array($query)) {
    $cid=$row['ClientID'];
    echo '<tr>
            <td>'.$row['ClientID'].'</td>
            <td><input type=\"checkbox\" name=\"checkbox'.$cid.'\" value='.$cid.'></td>
            <td>'.$row['FirstName'].'</td>
            <td>'.$row['LastName'].'</td>
            <td>'.$row['Email'].'</td>
            <td>'.$row['KDWP_Nbr'].'</td>
            <td>'. date('F d, Y', strtotime($row['DOB'])) . '</td>
            <td>'.$row['DriverLicenseNbr'].'</td>
            <td>'.$row['PrimaryPhone'].'</td>
            <td>'.$row['SecondaryPhone'].'</td>
            <td>'.$row['Address1'].'</td>
            <td>'.$row['Address2'].'</td>
            <td>'.$row['City'].'</td>
            <td>'.$row['State'].'</td>
            <td>'.$row['ZipCode'].'</td>
            <td>'.$row['ClientNotes'].'</td>
        </tr>';

Why wouldn't it show up as a checkbox?

thanksd
  • 54,176
  • 22
  • 157
  • 150
keith b
  • 19
  • 4
  • Since your echo begins with `'` you don't need to escape your `"` (double-quotes). – mickmackusa Apr 09 '17 at 13:41
  • Don't escape double quotes. To verify. Check your source of your Php page, youll see – Rotimi Apr 09 '17 at 13:42
  • I just ran it on phptester.net and it is a checkbox. This question can not be replicated and will be closed. Please edit you answer asap. – mickmackusa Apr 09 '17 at 13:44
  • Really? Someone upvoted this question? Delete this useless question already. – mickmackusa Apr 09 '17 at 13:54
  • Duplicate Question: http://stackoverflow.com/questions/18718724/textbox-displayed-instead-of-checkbox – mickmackusa Apr 09 '17 at 14:04
  • Possible duplicate of [How to read if a checkbox is checked in PHP?](http://stackoverflow.com/questions/4554758/how-to-read-if-a-checkbox-is-checked-in-php) – ozOli Apr 09 '17 at 14:59

1 Answers1

0

Remove slash

<input type="checkbox" name="checkbox'.$cid.'" value="'.$cid.'">
slaszka
  • 53
  • 7