homepage Welcome to WebmasterWorld Guest from 54.211.34.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
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

10+ Year Member



 
Msg#: 11378 posted 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

5+ Year Member



 
Msg#: 11378 posted 9:05 pm on Jan 14, 2006 (gmt 0)

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

simon2263

5+ Year Member



 
Msg#: 11378 posted 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

5+ Year Member



 
Msg#: 11378 posted 10:45 pm on Jan 14, 2006 (gmt 0)

or use:

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

pelachrum

10+ Year Member



 
Msg#: 11378 posted 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