Jump to content

url variable value don't work why?


ok

Recommended Posts

Hi guys i'm trying to attached a variable value into an url.

 

I have 2 files, the first file will send an email with a link and with variable value and the 2nd file will catch the variable value.

 

When i open the email and press the link it did show the url with the right variable value as an url, but the 2nd page that should catch those variables didn't display the variable value, meaning it's not working.

 

here is the codes that attach the variable value.

$message = "
<html>
<head>
</head>
<body>
<h3>Dear $ffname,</h3><br>
Your friend $ufname $ulname is inviting you to join a $50 dollar gas card.<br>
<a href=\"http://www.lexingtonssuddenvalues.com/contest.php?ufname={$ufname} \"><h4>Please Click here to join!</h4></a>
{$_POST['ufull_name']}
Join now and be a candidate to win the $50 dollar gas card every week.<br>
For more details please visit the link.<br><br>
<h4>Thank you!</h4>
</body>
</html>";

 

 

 

This is the full codes, that will email and attach the variable value.

<?php
echo "ufull_name: ". $ufull_name;
$_POST['ufull_name'] = $ufull_name;

$recepient = $femail;
$subject = "Tell a Friend Contest!";

$message = "
<html>
<head>
</head>
<body>
<h3>Dear $ffname,</h3><br>
Your friend $ufname $ulname is inviting you to join a $50 dollar gas card.<br>
<a href=\"http://www.lexingtonssuddenvalues.com/contest.php?ufname={$ufname} \"><h4>Please Click here to join!</h4></a>
{$_POST['ufull_name']}
Join now and be a candidate to win the $50 dollar gas card every week.<br>
For more details please visit the link.<br><br>
<h4>Thank you!</h4>
</body>
</html>";

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'From: lexingtonssuddenvalues.com <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";

// multiple recipients
$to  = $femail; 

mail($to, $subject, $message, $headers);
?>

 

by the way this is the 2nd page that suppose to catch the variable value.

<?php
$ufull_name = $_POST['ufull_name'];
echo "ufull_name: ". $ufull_name;
echo "<br>ureferer: ". $ureferer;
echo "<br>ufname: ". $ufname;
echo "<br>ulname: ". $ulname;
?>

 

Thank you!

 

 

Link to comment
https://forums.phpfreaks.com/topic/122472-url-variable-value-dont-work-why/
Share on other sites

You are using POST...if you want to get a value from the URL, you need to use GET.

 

So change

<?php
$ufull_name = $_POST['ufull_name'];
echo "ufull_name: ". $ufull_name;
echo "<br>ureferer: ". $ureferer;
echo "<br>ufname: ". $ufname;
echo "<br>ulname: ". $ulname;
?>

 

To

<?php
       $ufull_name = $_GET['ufname'];
echo "ufull_name: ". $ufull_name;
echo "<br>ureferer: ". $ureferer;
echo "<br>ufname: ". $ufname;
echo "<br>ulname: ". $ulname;
?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.