Click to See Complete Forum and Search --> : email form problem!


caynada
07-08-2003, 10:50 AM
Can anyone please have a look and tell me why I'm always directed to the error page when this form is filled out.

http://www.mc2.com.ky/beta/q&h/html/client_briefings.html

Here is the PHP code, the last nine inputs are check boxes. Could this be where I went wrong:

<?

$mailto = 'mc2@candw.ky' ;
$subject = "Client Briefings" ;


$formurl = "http://www.mc2.com.ky/beta/q&h/html/client_briefings.html" ;
$errorurl = "http://www.mc2.com.ky/beta/q&h/html/error.html" ;
$thankyouurl = "http://www.mc2.com.ky/beta/q&h/html/thankyou.html" ;

//--------------------------------------------------------

$title = $_POST['title'] ;
$firstname = $_POST['first name'] ;
$surname = $_POST['surname'] ;
$jobtitle = $_POST['job title'] ;
$company = $_POST['company'] ;
$mailingaddress = $_POST['mailing address'] ;
$email = $_POST['email'] ;
$phone = $_POST['phone'] ;
$companies = $_POST['companies law'] ;
$DirectorsDuties = $_POST['Directors Duties'] ;
$Investmentfunds = $_POST['Investment funds'] ;
$stockexchange = $_POST['stock exchange'] ;
$litigation = $_POST['litigation'] ;
$moneylaundery = $_POST['money laundery'] ;
$Securitisation = $_POST['Securitisation'] ;
$Portfolio = $_POST['Portfolio'] ;
$trusts = $_POST['trusts'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($phone) || empty($email) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.0" );
header( "Location: $thankyouurl" );
exit ;

?>

pyro
07-08-2003, 11:03 AM
If I were you, I would use a loop, rather than manually going through each field. Take a look at http://forums.webdeveloper.com/showthread.php?s=&threadid=9543#post48748