Page 1 of 1

Displays the wrong page???

Posted: Sun Sep 03, 2006 7:02 pm
by cturner
When I test the following code it displays the sent page without displaying the quote form first. Can someone please tell me why this is and how I can fix it? Thanks in advance.

Code: Select all

$arrErrors = array();
if (isset($_POST['send'])) {
	// contact details
	if ($_POST ['title'] == 'none') {
		$arrErrors['title'] = 'Please select your title.';
	}
	if ($_POST ['fullname'] == '') {
		$arrErrors['fullname'] = 'Please enter your full name.';
	}
	if ($_POST ['address'] == '') {
		$arrErrors['address'] = 'Please enter your address.';
	}
	if ($_POST ['phone'] == '') {
		$arrErrors['phone'] = 'Please enter your phone number.';
	}
	if (!preg_match("/\(?([0-9]{3})/", $_POST['phone'])) {
		$arrErrors['phone'] = 'Not a valid phone number.';
	}
	if ($_POST ['fax'] == '') {
		$arrErrors['fax'] = 'Please enter your fax number.';
	}
	if (!preg_match("/\(?([0-9]{3})/", $_POST['fax'])) {
		$arrErrors['phone'] = 'Not a valid fax number.';
	}
	if ($_POST ['email'] == '') {
		$arrErrors['email'] = 'Please enter your email address.';
	}
	if (!preg_match("/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/", $_POST['email'])) {
		$arrErrors['email'] = 'Not a valid email address.';
	}
	if ($_POST ['knowurl'] == 'none') {
		$arrErrors['knowurl'] = 'Please select how you knew about this url.';
	}
	if ($_POST ['selectNeeded'] == 'none') {
		$arrErrors['selectNeeded'] = 'Please select what is needed.';
	}

	// Project Details
	if (($_POST ['domainradiogroup'] == 'yes') && ($_POST['txtdomainyes'] == '')) {
		$arrErrors['txtdomainyes'] = 'Please enter the domain name that you have registered.';
	}
	if (($_POST ['domainradiogroup'] == 'no') && ($_POST['txtdomainno'] == '')) {
		$arrErrors['txtdomainno'] = 'Please enter your first and second preference for a domain name.';
	}
	if (($_POST ['hostingradiogroup'] == 'yes') && ($_POST['txthostingyes'] == '')) {
		$arrErrors['txthostingyes'] = 'Please state the web space provider\'s Internet address and the package you chose for this website.';
	}
	if ($_POST ['items'] == '') {
		$arrErrors['items'] = 'Please describe in detail what is in the items that you want displayed in your website.';
	}
	if (($_POST ['formsradiogroup'] == 'yes') && ($_POST['forms'] == '')) {
		$arrErrors['forms'] = '.';
	}
	if (($_POST ['filesradiogroup'] == 'yes') && ($_POST['files'] == '')) {
		$arrErrors['files'] = 'Please how many files need to be converted to PDF.';
	}
	if (($_POST ['scanradiogroup'] == 'yes') && ($_POST['scan'] == '')) {
		$arrErrors['scan'] = '.';
	}
	if ($_POST ['budget'] == '') {
		$arrErrors['budget'] = 'Please enter your budget for this website.';
	}
	if ($_POST ['additional'] == '') {
		$arrErrors['additional'] = 'Please explain in detail what you want your website visitors to do in your website.';
	}
}

if (count($arrErrors) == 0) {
	// My email address 
	$to = "mail@blueguminteractive.biz";

	$subject = "Quote Request from Web Site";
// Getting the variables from the contact form
// CONTACT DETAILS
$title = $_POST['title']; // Title
$fullname = $_POST['fullname']; // Full Name
$position = $_POST['position']; // Position
$company = $_POST['company']; // Company Name 
$address = $_POST['address']; // Address 
$phone = $_POST['phone']; // Phone Number 
$fax = $_POST['fax']; // Fax Number 
$mobile = $_POST['mobile']; // Mobile Number 
$email = $_POST['email']; // Email Number
$knowurl = $_POST['knowurl']; // How did you know about this url?
$selectNeeded = $_POST['selectNeeded']; // What is needed?
// PROJECT DETAILS
$domainradiogroup = $_POST['domainradiogroup']; // Domain name registered or not
$txtdomainyes = $_POST['txtdomainyes']; // Domain name registered or not
$txtdomainno = $_POST['txtdomainno']; // Domain name registered or not
$hostingradiogroup = $_POST['hostingradiogroup']; // Hosting Internet address
$txthosting = $_POST['txthosting']; // Hosting Internet address
$pages = $_POST['pages']; // How many web pages?
$items = $_POST['items']; // What items do you want displayed on the web site?
$formsradiogroup = $_POST['formsradiogroup']; // Do you require any forms (e.g. quote form)? If so, how many forms and what are the purposes for the form?
$txtforms = $_POST['txtforms']; //
$filesradiogroup = $_POST['filesradiogroup']; // Do you require any files to be converted to pdf? If so, how many?
$txtfiles = $_POST['txtfiles']; // Do you require any files to be converted to pdf? If so, how many?
$flashradiogroup = $_POST['flashradiogroup']; // Do you require any flash animation(s) for your site? If so, please describe what is required to be done?
$txtflash = $_POST['txtflash']; // Do you require any flash animation(s) for your site? If so, please describe what is required to be done?
$scanradiogroup = $_POST['scanradiogroup']; // Do you wish me to scan any images? If so, how many?
$txtscan = $_POST['txtscan']; // Do you wish me to scan any images? If so, how many?
$othersites = $_POST['othersites']; // If you have seen other web sites that contain features or elements that inspire you, please list the addresses below and describe what you like about each one.
$budget = $_POST['budget']; // What is the company's budget for this web site?
$completed = $_POST['completed']; // Do you have a date by which you would like the web site completed?
$additional = $_POST['additional']; // Additional information.

// The headers for the email 
$header = "From: $email";

// The message of the email
$message = 
"CONTACT DETAILS
Title: $title
Full Name: $fullname
Position: $position
Company Name: $company 
Address: $address 
Phone Number: $phone 
Fax Number: $fax 
Mobile Number: $mobile 
Email Address: $email
How did you know about this url? $knowurl
What is needed? $selectNeeded
PROJECT DETAILS
Has a domain name been registered for this web site? If so, what is the domain name? $domainradiogroup $txtdomainyes

If not, what is your first preference for a domain name and what is your second preference for a domain name? $domainradiogroup $txtdomainno

Have you registered with a web hosting company? If so, please state the web hosting's Internet address and the package you chose for 	this web site? $hostingradiogroup $txthosting

How many pages do think this web site will be? $pages

What items do you want displayed on the web site? $items

Do you require any forms? If so, how many forms and what are the purposes for the form, and what information will be displayed in the form(s)? $formsradiogroup $forms

Do you require any files to be converted to pdf? If so, how many? $filesradiogroup $files

Do you wish me to scan any images? If so, how many? $scanradiogroup $scan

What is the company's budget for this web site? $budget

Do you have a date by which you would like the web site completed? $completed

Please explain in detail what you want your web site visitors to do in your web site. $additional"; 

// Sending email
mail($to, $subject, $message, $header);

header('Location: quote_sent.php');  /* redirect */

    } else {
        // The error array had something in it. There was an error.
        // Start adding error text to an error string.
        $strError = '<div class="formerror"><p>Please check the following and try again:</p><ul>';
        // Get each error and add it to the error string
        // as a list item.
        foreach ($arrErrors as $error) {
            $strError .= "<li>$error</li>";
        }
        $strError .= '</ul></div>';
    }

Posted: Sun Sep 03, 2006 9:13 pm
by feyd
Since this doesn't appear to be all of the code, I can only assume that there is more page code before or after the posted snippet. So I can only guess that something in your page logic is always triggering this "sent page." Therefore I will say it's your call to count().