Forum Moderators: coopster

Message Too Old, No Replies

exclusion characters in PHP?

how to put an href tag in php form response?

         

cyberbites

5:50 pm on Feb 22, 2006 (gmt 0)

10+ Year Member



in this line of the response
$end_msg="<p align=center>Thanks!<br>Your mail has been sent.<br>";

I'd like to add the tag <a href="index.html"> Back</a>

to make it look like
$end_msg="<p align=center>Thanks!<br>Your mail has been sent.<br><a href="index.html"> Back</a>";

...but the quote characters in the href tag break the php script...

Is there an exclusion character I may use? ...or?
Thanks,
Mike

BarryStCyr

5:57 pm on Feb 22, 2006 (gmt 0)

10+ Year Member



All you have to do is add backslashes like this:

$end_msg="<p align=center>Thanks!<br>Your mail has been sent.<br><a href=\"index.html\"> Back</a>";

To be html correct you should have

$end_msg="<p align=\"center\">Thanks!<br>Your mail has been sent.<br><a href="index.html"> Back</a>";

Barry

Nutter

6:01 pm on Feb 22, 2006 (gmt 0)

10+ Year Member



Two choices, either use single quotes or escape the quotes.

1 - $end_msg='<p align=center>Thanks!<br>Your mail has been sent.<br><a href="index.html"> Back</a>';

2 - $end_msg="<p align=center>Thanks!<br>Your mail has been sent.<br><a href=\"index.html\"> Back</a>";

coopster

6:31 pm on Feb 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Actually there is one other option called 'heredoc' syntax. cyberbites, the 'exclusion character' you are talking about is commonly known as 'escaping' the character. As the others have shown, you have a few options when it comes to building Strings [php.net].

cyberbites

6:39 pm on Feb 22, 2006 (gmt 0)

10+ Year Member



This forum rocks!
Thank you all very much for your help.
Mike