homepage Welcome to WebmasterWorld Guest from 54.227.11.45
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Links in PHP
pelachrum




msg:1292659
 8:54 pm on Jan 14, 2006 (gmt 0)

is there any particular way links have to be served to php in order not to cause an error

for instance

echo "<a href="index.html">Some text here</a>";

will not work

 

FalseDawn




msg:1292660
 9:05 pm on Jan 14, 2006 (gmt 0)

Use
echo '<a href="index.html">Some text here</a>';

simon2263




msg:1292661
 9:49 pm on Jan 14, 2006 (gmt 0)


echo "<a href="index.html">Some text here</a>";

The problem here is with string termination. The string opens with the first ", and is closed by the first matching ". Hence the string is "<a href=". The rest is therefore syntactically incorrect PHP. If you want to nest quotes inside quotes (as you do here), the nested quotes must be different from the quotes used to open and close the string. So if you enclose the string in "...", then the nested quotes must be '...', and vice-versa.

Simon

niels




msg:1292662
 10:45 pm on Jan 14, 2006 (gmt 0)

or use:

echo "<a href=\"index.html\">Some text here</a>";

pelachrum




msg:1292663
 2:52 am on Jan 15, 2006 (gmt 0)

that does it
thanks

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved