Welcome to WebmasterWorld Guest from 54.163.68.15

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Links in PHP

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

10+ Year Member



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

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

10+ Year Member



Use
echo '<a href="index.html">Some text here</a>';
9:49 pm on Jan 14, 2006 (gmt 0)

10+ Year Member




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

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

10+ Year Member



or use:

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

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

10+ Year Member



that does it
thanks