I have this form working enough to send an email with the information from the form to my email account...
But I need it to go to 3 different success pages after clicking submit depending on what options are chosen.
Can someone look at the code and tell me what to fix. I think the problem is in the logic statements at the bottom.
The form is located at my form and the NVForm is where the below php came from.
<?php
/* $sendto is the email where form results are sent to */
$sendto = "arthurt@cihost.com";
/* $ccto is the email where form results can be carbon copied to */
/* Leave Blank if I do not nedd form sent to 2nd email address */
$ccto = "";
/* Verifies where form is sent from set = 1, = 0 if you don't want to check */
$setokurls = "1";
$okurls = "http://compusahosting.net,[url]http://compusahosting.com,http://www.compusahosting.com,http://www.compusahosting.net,63.249.142.24[/url]";
/* footer */
$footer = "<br><br><br><br><br><center><font face=\"Arial\"><a href=\"http://www.noviceform.com/\" target=\"_blank\"><font color=\"#ff0000\">Form processing script provided by Novice Form</font></a> </center></font>";
$backbutton = "<br><br><b>Hit your browsers back button and resubmit the form.</b>";
/* check to see if posted */
if ($HTTP_GET_VARS || ! $HTTP_POST_VARS || $_GET || ! $_POST) {
include("nverror.php");
no_pst();
}else{
/* IF OLDER VERSION OF PHP CONVERT TO NEWER VARIABLES */
if (! $_POST) {
$_POST = "$HTTP_POST_VARS";
}
if (! $_SERVER) {
$_SERVER = "$HTTP_SERVER_VARS";
}
$year = date("Y");
$month = date("m");
$day = date("d");
$hour = date("h");
$min = date("i");
$tod = date("a");
$ip=$_SERVER["REMOTE_ADDR"];
$SEND_prnt = "The form below was submited by " . $_POST{"email"} . " from Ip address: $ip on $monthnameactual $month/$day/$year at $hour:$min $tod \n";
$SEND_prnt .= "-------------------------------------------------------------------------\n\n";
/* CHECK TO SEE IF $_POST {"required"} IS SET */
if ($_POST{"required"}){
$post_required = $_POST{"required"};
$required = split(",", $post_required);
$reqnum = count($required);
for ($req=0; $req < $reqnum; $req++) {
$REQ_name = $required[$req];
$REQ_value = $POST{"$REQ_name"};
if ($REQ_name == "email") {
$goodem = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $_POST{"email"}, $trashed);
if (! $goodem) {
include("nverror.php");
msng_email();
} /* end ! $goodem */
}
elseif (! $_POST{"$REQ_name"}) {
$isreqe = "1";
$REQ_error .= "<li> $REQ_name ";
} /* end ! req val */
} /* end REQ for loop */
/* IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */
if ($isreqe == "1") {
include("nverror.php");
msng_required();
}
}
/* END CHECK TO SEE IF $_POST{"required"} IS SET */
/* END IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */
/* GET POSTED VARIABLES */
foreach ($_POST as $NVPOST_name => $NVPOST_value) {
/* GET CONTACTS EMAIL */
$email_lower = strtolower($NVPOST_name);
if ($email_lower == "email") {
$SEND_email = "$NVPOST_value";
}
/* END GET CONTACTS EMAIL */
if (! $_POST{"sort"}) {
/* CHECK TO SEE IF CONFIG FIELD */
if ($NVPOST_name == "subject" || $NVPOST_name == "sort" || $NVPOST_name == "required" || $NVPOST_name == "success_page"){}else{
$SEND_prnt .= "$NVPOST_name: $NVPOST_value \n";
}
} /* end ! sort */
} /* end foreach */
/* END GET POSTED VARIABLES */
if ($_POST{"sort"}) {
/* SORT VARIABLES */
$sortvars = split(",", $_POST{"sort"});
$sortnum = count($sortvars);
for ($num=0; $num < $sortnum; $num++) {
$SEND_prnt .= "$sortvars[$num]: " . $_POST{"$sortvars[$num]"} . " \n";
}
} /* END SORT VARIABLES */
/* send mail */
if (! $ccto) {
$header = "From: $SEND_email\r\nReply-to: $SEND_email";
}else{
$header = "From: $SEND_email\r\nReply-to: $SEND_email\r\nCc: $ccto";
}
mail($sendto, $_POST{"subject"}, $SEND_prnt, $header);
/* END sendmail */
/* CHECK TO SEE IF FORM SPECIFYS A SUCCESS PAGE */
if (! $_POST{"success_page"}) {
include("nverror.php");
default_success();
}else{
$successpage = $_POST{"success_page"};
//ebiz
IF
(
($_POST{"new_site"} == 'New Site') AND
($_POST{"content"} == 'CIHost Designs Site') AND
($_POST{"products"} == 'yes') AND
($_POST{"products_num"} == ('less than 25' OR '25-100' OR '101-500')) AND
($_POST{"pages_num"} == ('less than 5' OR '5-10')) AND
($_POST{"Database"} == 'No') AND
($_POST{"space"} == 'less than 1GB')
)
{
$successpage = "ebiz.html";
}
//intermediate
ELSE IF
(
($_POST{"content"} == 'Client Designs Site') AND
($_POST{"products"} == 'no') AND
($_POST{"pages_num"} == ('less than 5' OR '5-10' OR '11-20' OR '21-50')) AND
($_POST{"Database"} == ('Yes' OR 'No')) AND
($_POST{"space"} == ('less than 1GB' OR '1GB-10GB'))
)
{
$successpage = "intermediate.html";
}
//else defaults to custom
header("Location: $successpage");
/* redirect */
exit;
}
} /* END IF POSTED */
?>