Pass variables from one Script to another
Posted: Thu Apr 01, 2010 1:54 pm
I'm new to PHP, only about 3 months in. I'm trying to take a form a user fills out, check the $_POST variables to make sure all is good and if it is then I want to send those variables to a new page to be displayed. If there are Errors then it displays it above the form. Right now I have two outside scripts that check to make sure the email is a valid one and then if all is good another script to mail those variables. On to the code
Code: Select all
require('validemail.php');
require('mailsuccess.php');
$Errors = '';
if(isset($_POST['submit']))
{
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Phone']));
$Email = Trim(stripslashes($_POST['Email']));
$ConfirmEmail = Trim(stripslashes($_POST['ConfirmEmail']));
$Hdd = Trim(stripslashes($_POST['Hdd']));
$Warranty = Trim(stripslashes($_POST['Warranty']));
$Message = Trim(stripslashes($_POST['Message']));
$Captcha = Trim(stripslashes($_POST['Captcha']));
if (validemail($Email)){
// Make sure the required Fileds are completed and the email addresses match
if (empty($Name)) { $Errors .= "\n Please enter your name."; }
if (empty($Tel)) {$Errors .= "\n Please enter your telephone number."; }
if ($Email !== $ConfirmEmail) {$Errors .= "\n Your email addresses don't match."; }
if ($Captcha !== '4') {$Errors .= "\n The Captcha is incorrect."; }
if (empty($Errors)) {
success($Name, $Tel, $Email, $Hdd, $Warranty, $Message);
/* Here is where I'm trying to figure out how to send the variables to the new page to be displayed */
}
}
else { $Errors .= "\n Please enter a valid email."; }
}