• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

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>");
}
?>
0
freqout
Asked:
freqout
  • 2
1 Solution
 
MasonWolfCommented:
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)
0
 
MasonWolfCommented:
oh, alternately you can use:
echo "<a href='http://192.168.0.4/ver.php?text=$randno'>link</a>";
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now