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

Reply

Join Date: Nov 2008
Posts: 54
Reputation: whitestream6 is an unknown quantity at this point 
Solved Threads: 0
whitestream6 whitestream6 is offline Offline
Junior Poster in Training

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

 
0
  #1
33 Days Ago
This is the echo code from my site:
  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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 87
Reputation: hemgoyal_1990 is an unknown quantity at this point 
Solved Threads: 7
hemgoyal_1990's Avatar
hemgoyal_1990 hemgoyal_1990 is offline Offline
Junior Poster in Training
 
0
  #2
33 Days Ago
Originally Posted by whitestream6 View Post
This is the echo code from my site:
  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:

  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. ?>
http://www.kuchamancity.com
Hem Web Solution..
Behind Every Successful Man, There is an Untold Pain in His Heart.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 54
Reputation: whitestream6 is an unknown quantity at this point 
Solved Threads: 0
whitestream6 whitestream6 is offline Offline
Junior Poster in Training
 
0
  #3
33 Days Ago
Originally Posted by hemgoyal_1990 View Post
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:

  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:
$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:
Parse error: syntax error, unexpected T_STRING in C:\www\vhosts\mycarsite\testing.php on line 5
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 989
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 129
ardav's Avatar
ardav ardav is offline Offline
Posting Shark
 
-1
  #4
33 Days Ago
  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:

  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>.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 54
Reputation: whitestream6 is an unknown quantity at this point 
Solved Threads: 0
whitestream6 whitestream6 is offline Offline
Junior Poster in Training
 
0
  #5
33 Days Ago
Originally Posted by ardav View Post
Your problem is the non-catenated strings. Try this:

  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:
"New car of the day
- the second quotation marks set doesn't appear, for some reason.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 54
Reputation: whitestream6 is an unknown quantity at this point 
Solved Threads: 0
whitestream6 whitestream6 is offline Offline
Junior Poster in Training

Does this code work?

 
0
  #6
33 Days Ago
  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?
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 32
Reputation: kaion is an unknown quantity at this point 
Solved Threads: 5
kaion kaion is offline Offline
Light Poster
 
0
  #7
33 Days Ago
you can put it like this
  1. $autoguide1 = "<a href='$url1/buyers-guide/2010/volkswagen/passat.php'><strong>New car of the day</strong></a>";
hope that works shalom shalom
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 32
Reputation: kaion is an unknown quantity at this point 
Solved Threads: 5
kaion kaion is offline Offline
Light Poster
 
0
  #8
33 Days Ago
you can put it like this
  1. $autoguide1 = "<a href='$url1/buyers-guide/2010/volkswagen/passat.php'><strong>New car of the day</strong></a>";
hope that works shalom shalom
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 989
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 129
ardav's Avatar
ardav ardav is offline Offline
Posting Shark
 
-1
  #9
33 Days Ago
@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:

  1. vwpassat = "<strong>\"<a href=\"$url1/buyers-guide/2010/volkswagen/passat.php\">VW PASSAT ARGENTINA</a>\"</strong>";
should work
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 14
Reputation: soldierflup is an unknown quantity at this point 
Solved Threads: 0
soldierflup's Avatar
soldierflup soldierflup is offline Offline
Newbie Poster
 
0
  #10
30 Days Ago
If I understand your problem you would like to achieve the following :
"This is a new car" :
use this :

  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 :

  1. $car = "<a href='$url/somepage.php'><strong>&quot;This is a new car&quot;</strong></a>";
  2. echo $car;
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC