Page 2 of 2

Posted: Sat May 27, 2006 1:34 pm
by Hazarrd
could someone just show me how i could rewrite the end of this so that it just sends the form and redirects them to the header?

Posted: Sat May 27, 2006 5:19 pm
by RobertGonzalez
Try this. This is a bare-bones implementation, but if things crap out it should at least error.

Code: Select all

<?php
if ( isset($_POST['submit']) ) 
{
	$phone = $_POST['phone'];
	$email = $_POST['email'];
	$doctors_name = $_POST['doctors_name'];
	$practice_name = $_POST['practice_name'];
	$school = $_POST['school'];
	//foreach($_POST['office_descr'] as $value1) {
	//$office_descr_msg .= "Office description: $value1\n";
	//      }

	if (!empty($phone) && !empty($email) && !empty($doctors_name) && !empty($practice_name)) 
	{
		$body = "GENERAL INFORMATION\n\n";
		$body .= "Practice Name: $practice_name\n";
		$body .= "Doctor's Name: $doctors_name\n";
		$body .= "Office Address: $officeaddress1\n  $officeaddress2\n";
		$body .= "Phone: $phone\n";
		$body .= "E-Mail: $email\n";
		$body .= "Graduated from and year: $school\n";
		$body .= "Website: $website\n";
		
		if (mail("dta@comcast.net, nwilhelm@azmaneye.com, eyeazman@aol.com", "survey submission from website", $body, "From: $email" ))
		{
			header("Location: http://www.opt-technology.com/survey-confirmation.htm");
			exit;
		}
		else
		{
			echo "There was an error sending the message and it was not accepted.";
		}
	}
	else
	{
        header("Location: http://www.opt-technology.com/incomplete_error.htm");
	}
}
else
{
	// No form submission, so show a form or something
}
?>