VSK
VSK

Reputation: 131

Error when putting link in PHP-generated email

i am trying to send html text to email using php i write code for only message part below

$message="<html><body> 
<div><b>Title</b>:$app $vesion </div>
<div><a href="http://localhost/download/row[3]">Install Team Provisioning File</a>
</div> <br/>
<div><a href="http://localhost/download/row[5]">install binary</a>
</div>
 <div><b>Released</b>:$date</div> 
<body>
<html>";

but it shows error syntax error, unexpected T_STRING at a href part please suggest me for how append a herf in $message

Upvotes: 0

Views: 119

Answers (2)

blearn
blearn

Reputation: 1208

The internal quotations, in the href=... part are closing the wrapping quotes. Try this:

$message="<html><body> 
<div><b>Title</b>:$app $vesion </div>
<div><a href='http://localhost/download/" . $row[3] . "'>Install Team Provisioning File</a>
</div> <br/>
<div><a href='http://localhost/download/" . $row[5] . "'>install binary</a>
</div>
 <div><b>Released</b>:$date</div> 
<body>
<html>";

Upvotes: 2

Adam Plocher
Adam Plocher

Reputation: 14233

You need to escape your double-quotes with \"

$message="<html><body> 
<div><b>Title</b>:$app $vesion </div>
<div><a href=\"http://localhost/download/row[3]\">Install Team Provisioning File</a>
</div> <br/>
<div><a href=\"http://localhost/download/row[5]\">install binary</a>
</div>
 <div><b>Released</b>:$date</div> 
<body>
<html>";

Also, is row[3] and row[5] a PHP var? If so, it needs a $ in front.

Upvotes: 3

Related Questions