PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 6, 2022

[FIXED] how do I echo a website-linked photo in php?

 May 06, 2022     html, hyperlink, image, php     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing