Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-05-2012, 05:44 PM   PM User | #1
battleground
New to the CF scene

 
Join Date: May 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
battleground is an unknown quantity at this point
Insurance quote form

I am not having any luck with a form I am writing for an insurance quote.
here is the quote.html bowlfreaks.com/gbj/quote.html and here is my php.
When submitted, it breaks to error page.
Any thoughts?

PHP Code:
<?php

$mailto 
'***********@gmail.com' ;
$subject "Insurance Quote" ;
$formurl "http://bowlfreaks.com/gbj/quote.html" ;
$errorurl "http://www.yoursite.com/error.html" ;
$thankyouurl "http://www.yoursite.com/thankyou.html" ;
$uself 0;
$use_sendmailfrom 0;
$use_webmaster_email_for_from 0;
$use_utf8 1;
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" "\n" ;
$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' 'Content-Type: text/plain; charset="utf-8"' ;
if (isset( 
$use_sendmailfrom ) && $use_sendmailfrom) {

ini_set'sendmail_from'$mailto );
}
$firstname addslashes($_POST['firstname']) ;
$lastname addslashes($_POST['lastname']) ;
$birth addslashes($_POST['birth']) ;
$Address addslashes($_POST['Address']) ;
$city addslashes($_POST['city']) ;
$state addslashes($_POST['state']) ;
$zip addslashes($_POST['zip']) ;
$homephone addslashes($_POST['homephone']) ;
$workphone addslashes($_POST['workphone']) ;
$email addslashes($_POST['email']) ;
$head addslashes($_POST['head']) ;
$Gender addslashes($_POST['Gender']) ;
$marital addslashes($_POST['marital']) ;
$social addslashes($_POST['social']) ;
$licensed addslashes($_POST['licensed']) ;
$driven addslashes($_POST['driven']) ;
$tickets addslashes($_POST['tickets']) ;
$accidents addslashes($_POST['accidents']) ;
$subject addslashes($_POST['subject']) ;
$message addslashes($_POST['message']) ;
$http_referrer getenv"HTTP_REFERER" );

if (!isset(
$_POST['email'])) {

header"Location: $formurl" );

exit ;
}

$valid_email = (preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/im'$email)) ? true false;
$valid_firstname = (!empty($firstname)) ? true false;
$valid_lastname = (!empty($lastname)) ? true false;
$valid_birth = (!empty($birth)) ? true false;
$valid_Address = (!empty($Address)) ? true false;
$valid_city = (!empty($city)) ? true false;
$valid_state = (!empty($state)) ? true false;
$valid_zip = (!empty($zip)) ? true false;
$valid_homephone = (!empty($homephone)) ? true false;
$valid_workphone = (!empty($workphone)) ? true false;
$valid_email = (!empty($email)) ? true false;
$valid_head = (!empty($head)) ? true false;
$valid_Gender = (!empty($Gender)) ? true false;
$valid_marital = (!empty($marital)) ? true false;
$valid_social = (!empty($social)) ? true false;
$valid_licensed = (!empty($licensed)) ? true false;
$valid_driven = (!empty($driven)) ? true false;
$valid_tickets = (!empty($tickets)) ? true false;
$valid_accidents = (!empty($accidents)) ? true false;
$valid_message = (!empty($subject) && !empty($message)) ? true false;


$fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email $mailto ;

if (
get_magic_quotes_gpc()) {
    
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    while (list(
$key$val) = each($process)) {
        foreach (
$val as $k => $v) {
            unset(
$process[$key][$k]);
            if (
is_array($v)) {
                
$process[$key][stripslashes($k)] = $v;
                
$process[] = &$process[$key][stripslashes($k)];
            } else {
                
$process[$key][stripslashes($k)] = stripslashes($v);
            }
        }
    }
    unset(
$process);
}

$messageproper =

"This message was sent from:\n" .

"$http_referrer\n" .

"------------------------------------------------------------\n" .

"First Name: $firstname\n" .
"Last Name: $lastname\n" .
"City: $city\n" .
"State: $state\n" .
"Phone: $phone\n" .
"Email: $email\n" .
"Website: $website\n" .
"Subject: $subject\n" .

"------------------------- MESSAGE -------------------------\n\n" .

$message .

"\n\n------------------------------------------------------------\n" ;

$headers "From: \"$firstname\" <$fromemail>" $headersep "Reply-To: \"$firstname\" <$email>" $headersep "X-Mailer: chfeedback.php 2.15.0" $headersep 'MIME-Version: 1.0' $headersep $content_type ;

if (
$valid_email && $valid_firstname && $valid_lastname && $valid_city && $valid_state && $valid_message) {
mail$mailto$subject$messageproper$headers );
}

else {
header"Location: $errorurl" );
exit ;
}

header"Location: $thankyouurl" );
exit ;

?>
battleground is offline   Reply With Quote
Old 03-05-2012, 06:10 PM   PM User | #2
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
What error? What goes wrong?
Keleth is offline   Reply With Quote
Old 03-05-2012, 06:13 PM   PM User | #3
battleground
New to the CF scene

 
Join Date: May 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
battleground is an unknown quantity at this point
It breaks to "error" page. so it's not sending the info. So in the
"if (get_magic_quotes_gpc()" area, I think I might have a problem
battleground is offline   Reply With Quote
Old 03-05-2012, 07:08 PM   PM User | #4
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
You mean error.html? Did you check to see which of the validation's is failing?
Keleth is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:23 AM.


Advertisement
Log in to turn off these ads.