For a variable inside a echo that contains HTML, where would I add slashes to escape the double quotes?
Example:
echo "<input type=\"hidden\" name=\"id\" value=".$row['id']." />";
This part:
value=".$row['id']."
For a variable inside a echo that contains HTML, where would I add slashes to escape the double quotes?
Example:
echo "<input type=\"hidden\" name=\"id\" value=".$row['id']." />";
This part:
value=".$row['id']."
Some tips on outputting HTML with PHP:
htmlspecialchars()
to properly escape any "rogue" values you may have.Example using
echo
:Or
printf()
:Or, in HTML mode: