Variable is not getting its value

I'm sending email through PHP mailer for account verification, and it's sending and working. But there is an error in $mail->body part, because I'm passing $name variable to the <a> tag, but when I click on my received mail, it's still $name. It should be the posted name of my form but it's just displaying the $name text and not getting the value of $name. I think the problem is in this line (a syntax problem).

<?php
$name=$_POST['name'];
$mail->isHTML(true);

$mail->Body = '<b>Hello,this is just account activation process please click</b><a href="http://localhost/email_verification/register.php?nm=$name">Here</a><b> and you will be good to go.</b>';
?>

Answers


Please use double quote in your Body method.

$mail->Body    = "<b>Hello,this is just account activation process please click</b><a href=\"http://localhost/email_verification/register.php?nm=".$name."\">Here</a><b> and you will be good to go.</b>";

Need Your Help

how to insert and retrieve pdf from blob using Java

java mysql jdbc blob

I am trying to build some Java code that uses JDBC to:

Pandas, hierarchically labeling bar plot

python pandas plot charts

Asking the exact question as Is it possible to hierarchically label a matplotlib (pyplot) bar plot?, but for Pandas instead, as the answer is not there.