unable to put a link in the 'echo' command

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
n3wb1e
Forum Newbie
Posts: 3
Joined: Thu Aug 04, 2011 10:14 am

unable to put a link in the 'echo' command

Post by n3wb1e »

Ive given up trying to figure out why my 'header' function fails to redirect to a new page, so now Im using the 'echo' function. When a user submits a form utilising recaptcha, I get errors.

This works:
echo "Your email was successfully sent.<br /><br />";

This doesnt work:
echo "The security code entered was correct. Click <a href="index.php">here</a> to return to the homepage<br /><br />";

It spits out a server error message. Can someone tell me why?
Thanks.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: unable to put a link in the 'echo' command

Post by Celauran »

You need to escape quote inside what you're trying to echo.

Code: Select all

echo "The security code entered was correct. Click <a href=\"index.php\">here</a> to return to the homepage";
n3wb1e
Forum Newbie
Posts: 3
Joined: Thu Aug 04, 2011 10:14 am

Re: unable to put a link in the 'echo' command

Post by n3wb1e »

Thank you.
Post Reply