i have a script that allows me to gather data from a form and post it in a email , then away it goes
<?php
$email = $_REQUEST['email'];
$cname = $_REQUEST['cname'];
$rname = $_REQUEST['rname'];
$age = $_REQUEST['age'];
$timezone = $_REQUEST['timezone'];
$recieve = $_REQUEST['recieve'];
$contribute = $_REQUEST['contribute'];
/*Sending Email*/
$to = "illusive@leagueofdestruction.sitefrost.com";
$subject = "LoD App";
$message = "
Form1 Information
Email = $email
Character name = $cname
Real name = $rname
age = $age
Playtime / Timezone = $timezone
Recieve = $recieve
contribute = $contribute";
$from = "applicant@leagueofdestruction.com";
if(mail($to, $subject, $message, "From: $from"))
echo "Mail sent
You will be Redirected in 5 Seconds";
else
echo "Mail send failure - message not sent
You will be Redirected in 5 Seconds";
?>
<meta http-equiv="refresh" content="4;URL=index.html">
now i need to be able to validate that there is something in each box , if not redirect to fill.html
if successfully sends the email , direct them to emailsent.html for 5seconds then onto index.html
if unsuccessful , then redirect to noemail.html for 5 seconds then to index.html
i have this code and need help editing it to what i need
<?php
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "illusive@leagueofdestruction.sitefrost.com";
$Subject = Trim(stripslashes($_POST['Subject']));
$Name = Trim(stripslashes($_POST['Name']));
$CurrentWebAddress = Trim(stripslashes($_POST['CurrentWebAddress']));
$Comments = Trim(stripslashes($_POST['Comments']));
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=fill.html\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "CurrentWebAddress: ";
$Body .= $CurrentWebAddress;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $Comments;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=emailsent.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=noemail.html\">";
}
?>