简体   繁体   中英

how to use htmlspecialchars in the following code:

Someone told me that I have to use htmlspecialchars() when outputting to the screen but do I need it here under the $headers' section because I can't get it to work with it:

$company = "pianocourse101@hotmail.com";
$subject = "Activate your Premium membership Level 1 monthly account";
$mailTo = htmlspecialchars($email);
$headers = "From: ",htmlspecialchars($company);
$txt = "Thank you for registering with pianocourse101! At pianocourse101, your child can now learn how to play the piano right from the comfort of your own home! \n\nOur lessons are based from the Bastien Piano Basics series because it is both fun and educational for your child. \n\nHowever, you must activate your Premium membership Level 1 monthly account by clicking on the link below: \n\n http://localhost/loginsystem/includes/activatepremium.php?email=",htmlspecialchars($mailTo),"&activatetoken=",htmlspecialchars($token);

mail($mailTo, $subject, $txt, $headers);

I have a comma parse error..

$headers = "From: ".htmlspecialchars($company);

You should replace the comma with a point.
Commas are for enumerating parameters, points to concat strings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM