I intend to add two radio/option buttons to Davidundalicia's contact_us form template (see below in blue). What I need is that after clicking "Send Now", those users who selected Radio Button A will be directed to URL A and those selected Radio Button B will be directed to URL B. What should I add to the php file to make this possible?
<?PHP
// Receiving variables
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$comments = addslashes($_POST['comments']);
// error checking
if (strlen($name) == 0 )
{
header("Location: name_error.html");
exit;
}
if (strlen($email) == 0 )
{
header("Location: email_error.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: email_error.html");
exit;
}
if (substr_count($comments, '@') > "2")
{
header("Location: comments_error.html");
exit;
}
//Sending Email to form owner
$mailto = "your email address here";
$mailsubj = "Feedback from my website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values from my website form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
// Autoresponder
$mailto = $email;
$mailsubj = "Copy of the info you Submitted";
$mailhead = "From: website form\n";
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirmationpage.html");
?>
<?PHP
// Receiving variables
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$comments = addslashes($_POST['comments']);
// error checking
if (strlen($name) == 0 )
{
header("Location: name_error.html");
exit;
}
if (strlen($email) == 0 )
{
header("Location: email_error.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: email_error.html");
exit;
}
if (substr_count($comments, '@') > "2")
{
header("Location: comments_error.html");
exit;
}
//Sending Email to form owner
$mailto = "your email address here";
$mailsubj = "Feedback from my website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values from my website form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
// Autoresponder
$mailto = $email;
$mailsubj = "Copy of the info you Submitted";
$mailhead = "From: website form\n";
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirmationpage.html");
?>
Comment