Using php variable in href html links

here is what i am trying to do

 $store='something.com';
 echo  '<div><h3>click on</h3><a href='.$store.'>host</a></p></div>';

what it output is

something.com

instead it should use something.com as link and output need to be host.

try for sometime to do it my own but havn't achieved any success.

Answers


I am agree with the Answer of Ma'moon and it is right.

Php code does not work inside the single quotes ' ', so its required to place code inside the double quotes " ".

You can also use following method instead ↓

$store='something.com';
echo  "<div><h3>click on</h3><a href='$store'>host</a></p></div>";

This code will help you out:

<?php
$store='something.com';
echo  '<div><h3>click on</h3><a href="'.$store.'">host</a></p></div>';

Note the double quotes (") between the string concatenation (') this is needed by the browser to make render the proper href element.


Need Your Help

Running query in event procedure in Access?

sql ms-access vba

I have a combo box in my form with Member IDs, when I select a member ID, I want my txtLastName text box to be set to the member's name. I know what to write for the SQL query, but I don't know how...

Like Box plugin for my URL (not for Facebook Page URL)

facebook-like facebook-likebox

I want to have a likebox plugin for my own URL (not a Facebook Page URL)