Issue
I've looked at every other example of the problem I'm having and none have covered how to do an actual website URL link within an echoed image in PHP. I'm sure I have to use an escape character of some sort but I'm not sure where or which one. here is my code
<?php
echo "<a href=\'https://validator.w3.org/nu/"><img src="HTMLVALIDATIONIMAGE.png" /></a>";
echo "<a href=\'https://validator.w3.org/nu/"><img src="CSSVALIDATIONIMAGE.png" /></a>"";
echo "<b>Last Modified:</b> " . date('F d Y h:i A', filemtime($_SERVER['SCRIPT_FILENAME']));
?>
Solution
Use single quotes around the HTML attributes when you're using double quotes around the PHP string. Then you don't need to escape anything.
echo "<a href='https://validator.w3.org/nu/'><img src='HTMLVALIDATIONIMAGE.png'></a>";
Answered By - Barmar Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.