943,982 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2238
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Oct 31st, 2009
0

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

Expand Post »
This is the echo code from my site:
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. $url1 = "http://www.canadiandriver.com";
  3. $url2 = "http://www.chevrolet.com.br";
  4. $autoguide = "Autoweekly";
  5. $autoguide1 = /"<b>"<a href=\"$url1\buyers-guide/2010/volkswagen/passat.php"\>New car of the day</a>"/</b>";
  6. ?>

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.
Reputation Points: 15
Solved Threads: 0
Junior Poster
whitestream6 is offline Offline
169 posts
since Nov 2008
Oct 31st, 2009
0
Re: Echo URL in PHP - having problems with a href in echo
This is the echo code from my site:
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. $url1 = "http://www.canadiandriver.com";
  3. $url2 = "http://www.chevrolet.com.br";
  4. $autoguide = "Autoweekly";
  5. $autoguide1 = /"<b>"<a href=\"$url1\buyers-guide/2010/volkswagen/passat.php"\>New car of the day</a>"/</b>";
  6. ?>

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 Syntax (Toggle Plain Text)
  1. <?php
  2. $url1 = "http://www.canadiandriver.com";
  3. $url2 = "http://www.chevrolet.com.br";
  4. $autoguide = "Autoweekly";
  5. $autoguide1 = "<b><a href=$url1/buyers-guide/2010/volkswagen/passat.php>New car of the day</a></b>";
  6. echo "$autoguide"; //if u dont want to print the auoguide variable then remove this line.
  7. echo "$autoguide1";
  8. ?>
Reputation Points: 18
Solved Threads: 17
Junior Poster
hemgoyal_1990 is offline Offline
175 posts
since Aug 2007
Oct 31st, 2009
0
Re: Echo URL in PHP - having problems with a href in echo
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 Syntax (Toggle Plain Text)
  1. <?php
  2. $url1 = "http://www.canadiandriver.com";
  3. $url2 = "http://www.chevrolet.com.br";
  4. $autoguide = "Autoweekly";
  5. $autoguide1 = "<b><a href=$url1/buyers-guide/2010/volkswagen/passat.php>New car of the day</a></b>";
  6. echo "$autoguide"; //if u dont want to print the auoguide variable then remove this line.
  7. echo "$autoguide1";
  8. ?>
Thank you for that - the code below worked:
Quote ...
$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";
However, what should I do to make the quotation marks bold within $autoguide1 without getting this error:
Quote ...
Parse error: syntax error, unexpected T_STRING in C:\www\vhosts\mycarsite\testing.php on line 5
Reputation Points: 15
Solved Threads: 0
Junior Poster
whitestream6 is offline Offline
169 posts
since Nov 2008
Oct 31st, 2009
-1
Re: Echo URL in PHP - having problems with a href in echo
Quote ...
PHP Syntax (Toggle Plain Text)
  1. $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:

PHP Syntax (Toggle Plain Text)
  1. $autoguide1 = "<strong><a href='$url1/buyers-guide/2010/volkswagen/passat.php'>New car of the day</a></strong>";

<b> is (or is being) deprecated - use <strong>.
Sponsor
Featured Poster
Reputation Points: 1054
Solved Threads: 949
Sarcastic Poster
ardav is offline Offline
6,700 posts
since Oct 2006
Oct 31st, 2009
0
Re: Echo URL in PHP - having problems with a href in echo
Click to Expand / Collapse  Quote originally posted by ardav ...
Your problem is the non-catenated strings. Try this:

PHP Syntax (Toggle Plain Text)
  1. $autoguide1 = "<strong><a href='$url1/buyers-guide/2010/volkswagen/passat.php'>New car of the day</a></strong>";

<b> is (or is being) deprecated - use <strong>.
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:
Quote ...
"New car of the day
- the second quotation marks set doesn't appear, for some reason.
Reputation Points: 15
Solved Threads: 0
Junior Poster
whitestream6 is offline Offline
169 posts
since Nov 2008
Oct 31st, 2009
0

Does this code work?

PHP Syntax (Toggle Plain Text)
  1. $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?
Reputation Points: 15
Solved Threads: 0
Junior Poster
whitestream6 is offline Offline
169 posts
since Nov 2008
Oct 31st, 2009
0
Re: Echo URL in PHP - having problems with a href in echo
you can put it like this
PHP Syntax (Toggle Plain Text)
  1. $autoguide1 = "<a href='$url1/buyers-guide/2010/volkswagen/passat.php'><strong>New car of the day</strong></a>";
hope that works shalom shalom
Reputation Points: 13
Solved Threads: 8
Light Poster
kaion is offline Offline
36 posts
since Apr 2009
Oct 31st, 2009
0
Re: Echo URL in PHP - having problems with a href in echo
you can put it like this
PHP Syntax (Toggle Plain Text)
  1. $autoguide1 = "<a href='$url1/buyers-guide/2010/volkswagen/passat.php'><strong>New car of the day</strong></a>";
hope that works shalom shalom
Reputation Points: 13
Solved Threads: 8
Light Poster
kaion is offline Offline
36 posts
since Apr 2009
Oct 31st, 2009
-1
Re: Echo URL in PHP - having problems with a href in echo
@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:

PHP Syntax (Toggle Plain Text)
  1. vwpassat = "<strong>\"<a href=\"$url1/buyers-guide/2010/volkswagen/passat.php\">VW PASSAT ARGENTINA</a>\"</strong>";
should work
Sponsor
Featured Poster
Reputation Points: 1054
Solved Threads: 949
Sarcastic Poster
ardav is offline Offline
6,700 posts
since Oct 2006
Nov 4th, 2009
0
Re: Echo URL in PHP - having problems with a href in echo
If I understand your problem you would like to achieve the following :
"This is a new car" :
use this :

PHP Syntax (Toggle Plain Text)
  1. $car = "<a href='$url/somepage.php'><strong>&quot;</strong>This is a new car<strong>&quot;</strong></a>";
  2. echo $car;

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

PHP Syntax (Toggle Plain Text)
  1. $car = "<a href='$url/somepage.php'><strong>&quot;This is a new car&quot;</strong></a>";
  2. echo $car;
Reputation Points: 14
Solved Threads: 4
Light Poster
soldierflup is offline Offline
26 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Messaging System
Next Thread in PHP Forum Timeline: Retrieve all $_POST values...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC