Correct Syntax for this simple piece of code ?

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
newphper
Forum Commoner
Posts: 26
Joined: Mon Mar 21, 2011 1:48 am
Location: Bridgeman Downs, Qld, Australia

Correct Syntax for this simple piece of code ?

Post by newphper »

Hello Again,

Could anyone advise me as to the correct syntax for this code snippet please ?

It doesn't seem quite right where the 2nd last line line has $mesg = '<html>
Shouldn't it have either a closing inverted comma or possibly double quotes at start and finish of <html> ??

Here is the the code below

Code: Select all

//send the mail
mail($recipient, $subject, $mesg, $mailheaders);
}
else if($event_group_event == "yes")
{
$subject =$client_first_name;
$subject .= ", ";
if($client_gender ==  "male")
$subject .= $event_male_subject;
if($client_gender == "female")
$subject .= $event_female_subject;
$mesg = '<html>
<head>
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: Correct Syntax for this simple piece of code ?

Post by akuji36 »

Hello

Take a look at the following link:

http://www.fasthosts.co.uk/knowledge-ba ... icle_id=70
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Correct Syntax for this simple piece of code ?

Post by social_experiment »

You want to encase the whole email body in quotes. Single or double doesn't really matter you just have to escape correctly if you are using any of the same quotation marks elsewhere inside $mseg.

Code: Select all

$mesg = '<html>
<head>
</head>
<body>
</body>
</html>';
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
newphper
Forum Commoner
Posts: 26
Joined: Mon Mar 21, 2011 1:48 am
Location: Bridgeman Downs, Qld, Australia

Re: Correct Syntax for this simple piece of code ?

Post by newphper »

Thank you for your help, that clears my problem up.
Post Reply