Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7780209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:50:02+00:00 2026-06-01T18:50:02+00:00

How do I go about using an image as a link in php? I

  • 0

How do I go about using an image as a link in php? I have never put two html elements together in one echo so it’s kinda new for me.
Here’s my code:

htmltest.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?
   require("includes/conn.php"); //link to the database
?>
<html> 
<title>HTML with PHP</title>
<body>

<?php
      echo  "<a  href="pageone.php"><img src="homelogo.jpg"  /></a>";
?>

</body>
</html>

That’s my code. I get the following error:

PHP Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /home6/dreamsm2/public_html/htmltest.php on line 11

Can anyone tell me what I’m doing wrong? Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:50:03+00:00Added an answer on June 1, 2026 at 6:50 pm

    Change the line to:

    echo  '<a href="pageone.php"><img src="homelogo.jpg"  /></a>';
    

    OR

    echo  "<a href=\"pageone.php\"><img src=\"homelogo.jpg\"  /></a>";
    

    The problem, as the error somewhat suggests, is that the PHP interpreter can’t figure out where your string is supposed to start and end. Using \" escapes the quotes. Using ' around the string gives a unique string delimiter around the string, so you are free to use double quotes inside.

    Note, if you needed both single and double:

    echo  '<a href="pageone.php" title="Andy\'s Link"><img src="homelogo.jpg"  /></a>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple gallery style link setup using image swap on hover that
i have a question about using GalleryView. At first, i set five default images
I have a question about using streams in .NET to load files from disk.
I have a question about using os.execvp in Python. I have the following bit
Sorry about the length here. I'm using oscommerce and have a page with all
I've created a blog main page using PHP and have included a sidebar and
I have the following php code: <?php $image = imagecreatefrompng(captcha_background.png); $imgcolor = imagecolorallocate($image, 0,
I want to implement a web page (using HTML/PHP, whatever else), that will populate
Using PHP, JS, or HTML (or something similar) how would I capture keystokes? Such
I have two virtual systems for development. First one is Windows + xampp (apache,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.