Home > database >  Cannot concatenate with the link
Cannot concatenate with the link

Time:09-26

Hello why is it that I cannot include in the link when I concatenate?

here is the code.

$mail->Subject = 'Verification Link';
 $mail->Body    = 'http://localhost/Mailer/verification.php?code='.$user_verificationCode;
 $mail->AltBody = 'http://localhost/Mailer/verification.php?code='.$user_verificationCode;

But the $userverifcation is not included in the link even when I concatenate it? Here is the sample link: http://localhost/Mailer/verificationForgot.php?code= Zk8gIT

enter image description here

As you can see it is not included in the link? WHat should I do?

CodePudding user response:

You have a space in $user_verificationCode. You should use trim to remove it before append to URL.

$mail->Subject = 'Verification Link';
$mail->Body    = 'http://localhost/Mailer/verification.php?code='.trim($user_verificationCode);
$mail->AltBody = 'http://localhost/Mailer/verification.php?code='.trim($user_verificationCode);

CodePudding user response:

you can also use a double quote instead of a single quote.

$mail->Subject = 'Verification Link';
$mail->Body    = "http://localhost/Mailer/verification.php?code=$user_verificationCode";
$mail->AltBody = "http://localhost/Mailer/verification.php?code=$user_verificationCode";
  •  Tags:  
  • php
  • Related