Link to home
Start Free TrialLog in
Avatar of freqout
freqout

asked on

PHP not echoing after adding variable to URL

Trying to send an verification email and testing generating the url, when I try to add the random number I already have defined earlier in the script $randno, it doesnt work, when I take it out it does. Any ideas?
<?php
$to = "steven.taylor@aptare.com";
$new = htmlspecialchars("<a href=''>testing<a/>", ENT_QUOTES);
$randno = rand(0,100);
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
  echo $new;
echo "<a href='http://192.168.0.4/ver.php?text=" $randno "'>link</a>";
} else {
  echo("<p>Message delivery failed...</p>");
}
?>
Avatar of MasonWolf
MasonWolf
Flag of United States of America image

change:
echo "<a href='http://192.168.0.4/ver.php?text=" $randno "'>link</a>";
to:
echo "<a href='http://192.168.0.4/ver.php?text=" .$randno. "'>link</a>";

(the period is the php string concatenation operator)
ASKER CERTIFIED SOLUTION
Avatar of MasonWolf
MasonWolf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial