0

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

1

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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>"; 

1 Comment

You don't need to end your quotes to use a variable when dealing with double quotes. You only need to do that if you're using the single quotes. echo "something $var"; is the same as echo "something " . $var; which is different from echo 'something $var';

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.