开发者

Preserve link in php form

I've created a form that sends two email: 1. To me 2. A confirmation email to the user with a link to some other information

<?php
$to ='email@email.com';
$subject ="This is My Subject";
$header="From: $firstName $lastName <$email>";
$message = "Name: $firstName $lastName \n\nPhone: $phone \n\nEmail: $email";
$send_contact=mail($to,$subject,$message,$header);

if ( $send_contact ) {
echo "Super fun message";
}
else {
echo "ERROR";
}

$to1 = $email;
$subject1 ="This is my email Subject";
$header1="From: email@email.com <email@email.com>";
$message1 = "Thanks check out this <a href="http://link.com" title="">link</a>.";
$send_contact1=mail($to1,$subject1,$message1,$header1);

?>

Problem, I think, is the syntax for the link in $message1 isn't correct... I j开发者_JAVA百科ust can't get it right.

Thanks for your help!


It's because the quotation mark just before the link match the one at the start on $message1, change them to single quotation marks and you should be fine.

$message1 = "Thanks check out this <a href='www.link.com' title=''>link</a>."


You are mixing up the quotes, hence confusing the interpreter and resulting into error. Proper way to use in such cases is first ""(double quotes) and then ''(Single quotes) .

The above example is good one. You can refer to that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜