Jump to content

varable $x wont show weired please help


redarrow

Recommended Posts

varable $x wont show in the email messsage very weired.....

 

ive tried sessions aswell.....

 

<?php session_start();

echo"<center>
<h3>Please select a free item to order via the link provided!</h3>
<br>
<a href='".$_SERVER['PHP_SELF']."?ref=free_cup'>Order free cup</a>
<p></p>
<a href='".$_SERVER['PHP_SELF']."?ref=free_shirt'>Order free shirt</a>
<p></p>
<a href='".$_SERVER['PHP_SELF']."?ref=free_pen'>Order free pen</a>
<p></p>
<h3>Please be advised a specil link will be sent via your email 
address to collect your free gift!<h3> 
</center>";

$x=$_GET['ref'];

$_SESSION['x']=$x;

$form_order="
<center>
<form method='POST' action='".$_SERVER['PHP_SELF']."?ref=email'>
<p></p>
Order form for a free <font color='red'>".$_SESSION['x']."</font>!
<p></p>
username!
<br>
<input type='text' name='username'>
<p></p>
Valid email!
<br>
<input hidden='text' name='x' value='".$_SESSION['x']."'>
<input type='text' name='email_address'>
<br><br>
<input type='submit' name='submit' value='Send the free item to my email address please!'>
</center>
";


switch ($_GET['ref']){
case "free_cup":
echo "<br><br>$form_order<br><br>";
exit;
case "free_shirt":
echo "<br<br>$form_order<br><br>";
exit;
case "free_pen":
echo "<br><br>$form_order<br><br>";
exit;

case "email":


if($_POST['submit']){

if($_GET['ref']=="email"){

$x=$_POST['x'];

$username=$_POST['username'];

$email_address=$_POST['email_address'];

$mes=" Thank you $username for the order of a $x it in the post 
       give the post man maximun 15 days please re order if the free 
       product dosent arrive in that time thank you.";

$to = $email_address;
$subject = 'Your '.$x.' ';
$message = $mes;
$headers = "From: [email protected]\r\n" .
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: 8bit\r\n\r\n";

// Send
if(mail($to, $subject, $message, $headers)){

echo"Thank you $username your $x 
specil link been sent to your email address of $email_address!";
}else{

echo "Sorry $username the $email_address issint working! <br>
Please try to re order your $x agin!";
}
}
  }	
exit;
}

?>

Link to comment
https://forums.phpfreaks.com/topic/99004-varable-x-wont-show-weired-please-help/
Share on other sites

the switch nocks the varable out..........

 

if you trie ur see what im try to do...........

 

a user press a link the link takes them to a switch

then the value off x should be printed on the mail code.........

 

ive tried session, get, post, everthink man......

 

looks like i need to rewrite the switch

SOLVED..................

<?php session_start();

echo"<center>
<h3>Please select a free item to order via the link provided!</h3>
<br>
<a href='".$_SERVER['PHP_SELF']."?ref=free_cup'>Order free cup</a>
<p></p>
<a href='".$_SERVER['PHP_SELF']."?ref=free_shirt'>Order free shirt</a>
<p></p>
<a href='".$_SERVER['PHP_SELF']."?ref=free_pen'>Order free pen</a>
<p></p>
<h3>Please be advised a specil link will be sent via your email 
address to collect your free gift!<h3> 
</center>";


$form_order="
<center>
<form method='POST' action='".$_SERVER['PHP_SELF']."?ref=email'>
<p></p>
Order form for a free <font color='red'>".$_GET['ref']."</font>!
<p></p>
username!
<br>
<input type='text' name='username'>
<p></p>
Valid email!
<br>
<input hidden='text' name='x' value='".$_GET['ref']."'>
<input type='text' name='email_address'>
<br><br>
<input type='submit' name='submit' value='Send the free item to my email address please!'>
</center>
";


switch ($_GET['ref']){
case "free_cup":
echo "<br><br>$form_order<br><br>";
exit;
case "free_shirt":
echo "<br<br>$form_order<br><br>";
exit;
case "free_pen":
echo "<br><br>$form_order<br><br>";
exit;
}

if($_POST['submit']){


$x=$_POST['x'];

$username=$_POST['username'];

$email_address=$_POST['email_address'];

$mes=" Thank you $username for the order of a $x it in the post 
       give the post man maximun 15 days please re order if the free 
       product dosent arrive in that time thank you.";

$to = $email_address;
$subject = 'Your '.$x.' ';
$message = $mes;
$headers = "From: [email protected]\r\n" .
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: 8bit\r\n\r\n";

// Send
if(mail($to, $subject, $message, $headers)){

echo"Thank you $username your $x 
specil link been sent to your email address of $email_address!";
}else{

echo "Sorry $username the $email_address issint working! <br>
Please try to re order your $x agin!";
}
}
  ?>

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.