954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Echo URL in PHP - having problems with a href in echo

This is the echo code from my site:

<?php
$url1 = "http://www.canadiandriver.com";
$url2 = "http://www.chevrolet.com.br";
$autoguide = "Autoweekly";
$autoguide1 = /"<b>"<a href=\"$url1\buyers-guide/2010/volkswagen/passat.php"\>New car of the day</a>"/</b>";
?>


Yet it produces a T_STRING error, and I can't work out how to fix it.
The other variables work fine, $autoguide1 does not, and no matter how much I practice, this one is hard for me to figure out.
Any advice is appreciated, thanks.

whitestream6
Junior Poster
174 posts since Nov 2008
Reputation Points: 15
Solved Threads: 0
 

This is the echo code from my site:

<?php
$url1 = "http://www.canadiandriver.com";
$url2 = "http://www.chevrolet.com.br";
$autoguide = "Autoweekly";
$autoguide1 = /"<b>"<a href=\"$url1\buyers-guide/2010/volkswagen/passat.php"\>New car of the day</a>"/</b>";
?>

Yet it produces a T_STRING error, and I can't work out how to fix it. The other variables work fine, $autoguide1 does not, and no matter how much I practice, this one is hard for me to figure out. Any advice is appreciated, thanks.

Dear Friend.
I am Not Understand that Actually What You want to Do with The above Code but if u want to print the autoguide1 variable then plz follow below code:

<?php
$url1 = "http://www.canadiandriver.com";
$url2 = "http://www.chevrolet.com.br";
$autoguide = "Autoweekly";
$autoguide1 = "<b><a href=$url1/buyers-guide/2010/volkswagen/passat.php>New car of the day</a></b>";
echo "$autoguide"; //if u dont want to print the auoguide variable then remove this line.
echo "$autoguide1";
?>
hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

Dear Friend. I am Not Understand that Actually What You want to Do with The above Code but if u want to print the autoguide1 variable then plz follow below code:

<?php
$url1 = "http://www.canadiandriver.com";
$url2 = "http://www.chevrolet.com.br";
$autoguide = "Autoweekly";
$autoguide1 = "<b><a href=$url1/buyers-guide/2010/volkswagen/passat.php>New car of the day</a></b>";
echo "$autoguide"; //if u dont want to print the auoguide variable then remove this line.
echo "$autoguide1";
?>

Thank you for that - the code below worked:$autoguide1 = "New car of the day";
echo "$autoguide"; //if u dont want to print the auoguide variable then remove this line.
echo "$autoguide1";

However, what should I do to make the quotation marks bold within $autoguide1 without getting this error:Parse error: syntax error, unexpected T_STRING in C:\www\vhosts\mycarsite\testing.php on line 5

whitestream6
Junior Poster
174 posts since Nov 2008
Reputation Points: 15
Solved Threads: 0
 
$autoguide1 = /"<b>"<a href=\"$url1\buyers-guide/2010/volkswagen/passat.php"\>New car of the day</a>"/</b>";

Your problem is the non-catenated strings. Try this:

$autoguide1 = "<strong><a href='$url1/buyers-guide/2010/volkswagen/passat.php'>New car of the day</a></strong>";

is (or is being) deprecated - use .

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Your problem is the non-catenated strings. Try this:

$autoguide1 = "<strong><a href='$url1/buyers-guide/2010/volkswagen/passat.php'>New car of the day</a></strong>";

is (or is being) deprecated - use .

Thanks, that worked, however, how do I make the quotation marks bold within $autoguide1 - I only get the first one and it ends up as this:"New car of the day

- the second quotation marks set doesn't appear, for some reason.

whitestream6
Junior Poster
174 posts since Nov 2008
Reputation Points: 15
Solved Threads: 0
 
$vwpassat = "<strong>\"<a href='$url1/buyers-guide/2010/volkswagen/passat.php'>VW PASSAT ARGENTINA</a>\"</strong>";


This seems to work - is this the correct syntax for bold quotation marks now?

whitestream6
Junior Poster
174 posts since Nov 2008
Reputation Points: 15
Solved Threads: 0
 

you can put it like this

$autoguide1 = "<a href='$url1/buyers-guide/2010/volkswagen/passat.php'><strong>New car of the day</strong></a>";

hope that works shalom shalom

kaion
Light Poster
36 posts since Apr 2009
Reputation Points: 13
Solved Threads: 8
 

you can put it like this

$autoguide1 = "<a href='$url1/buyers-guide/2010/volkswagen/passat.php'><strong>New car of the day</strong></a>";

hope that works shalom shalom

kaion
Light Poster
36 posts since Apr 2009
Reputation Points: 13
Solved Threads: 8
 

@whitestream:
Yes that's fine - I'm sorry, I didn't realise you needed the quote marks in the displayed text.

Hmm, I was once told that attribute values should be placed in double quote marks for XHTML - however I can't remember seeing that in my cursories. If you need this:

vwpassat = "<strong>\"<a href=\"$url1/buyers-guide/2010/volkswagen/passat.php\">VW PASSAT ARGENTINA</a>\"</strong>";

should work

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

If I understand your problem you would like to achieve the following :
"This is a new car" :
use this :

$car = "<a href='$url/somepage.php'><strong>&quot;</strong>This is a new car<strong>&quot;</strong></a>";
echo $car;


If you would achieve this :"This is a new car"
then use this :

$car = "<a href='$url/somepage.php'><strong>&quot;This is a new car&quot;</strong></a>";
echo $car;
soldierflup
Light Poster
26 posts since Nov 2008
Reputation Points: 14
Solved Threads: 4
 

This is the echo code from my site:

<?php
$url1 = "http://www.canadiandriver.com";
$url2 = "http://www.chevrolet.com.br";
$autoguide = "Autoweekly";
$autoguide1 = /"<b>"<a href=\"$url1\buyers-guide/2010/volkswagen/passat.php"\>New car of the day</a>"/</b>";
?>

Yet it produces a T_STRING error, and I can't work out how to fix it. The other variables work fine, $autoguide1 does not, and no matter how much I practice, this one is hard for me to figure out. Any advice is appreciated, thanks.


hii

if u simply want to print $autoguide and $autoguide1
then write this below ur code

echo $autoguide . "";
echo $autoguide1;

pratik.itworld
Newbie Poster
2 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

yeah use quotes. but u should use these ones:


-left


-right


from here: http://www.yourhtmlsource.com/text/specialcharacters.html
i heard using the numbers is more cross browser vs the “ and the ”
edits:sorry they dont come out in numbers

SKANK!!!!!
Posting Pro in Training
429 posts since Apr 2009
Reputation Points: 15
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You