I have a problem where I am trying to output a checkbox on an html page the only problem is I want to use a variable that is in $row[‘STUDENT_ID’] but the checkbox also has double quotes, which is what I am using for echo. The double and single quotes are confusing me and I can’t get it to work quite right.
echo "
<tr>
<td><input type="checkbox" name="name" value=". $row['STUDENT_ID'] . " />
<td>" . $row['STUDENT_ID'] . "</td>
<td>" . $row['FName'] . "</td>
<td>" . $row['LName'] . " </td>
</tr>
";
In such cases use a HEREDOC string instead:
Also notice the
{$..}curly string syntax for embedding the$row[]values.