i have a table that display a record from the database. Using this php file i would like to display the table inside the php file. I know is something wrong with this line in my code but i don’t know how to fix it. I am trying to use a checkbox here to delete a row in my database.
here is that line of code:
echo "<td> <input name=\"need_delete[<? echo $rows['id']; ?>]\" type=\"checkbox\" id=\"checkbox[<? echo $rows['id']; ?>]\" value=\"<? echo $rows['id']; ?>\"> </td>";
Thanks in advance !!
The reason it’s wrong is because you’re attempting to use php code (the variables) in the middle of a string. You must first close the string and then display the variables:
Alternatively you can close the PHP code and make it interpret as HTML (I prefer this way):