Second part of the script , sorry too many characters
// Check if the form has been submitted.
if (isset($_POST['submit']))
{
$problem = FALSE; // No problems so far.
//check to see if fields are populated in the top of the form
//if (!is_numeric($crowd_range1) || !is_numeric($crowd_range2) || !is_numeric($crowd_range3)) {
//************************** start top form checks **********************************
if (empty ($ename)) //check for first name
{
$problem = TRUE;
echo '<p>You forgot to enter the event name, Please hit the back button and fill in the missing information</p>';
}
if (empty ($evenue))
{
$problem = TRUE;
echo '<p>You forgot to enter the Event Venue, Please hit the back button and fill in the missing information</p>';
}
if (empty($emonth))
{
$problem = TRUE;
echo '<p>You forgot to enter the month of the event, please hit the back button and select the correct month from the drop down menu</p>';
}
if (empty($eday))
{
$problem = TRUE;
echo '<p>You forgot to enter the day of the event, please hit the back button and select the correct day from the drop down menu</p>';
}
if (empty($eyear))
{
$problem = TRUE;
echo '<p>You forgot to enter the year of the event, please hit the back button and select the correct year from the drop down menu</p>';
}
if (empty($num_tickets))
{
$problem = TRUE;
echo '<p>You forgot to enter the number of tickets you have for this event, Please hit the back button and fill in the missing information</p>';
}
if (empty($section))
{
$problem = TRUE;
echo '<p>You forgot to enter the section(s) for this event, Please hit the back button and fill in the missing information</p>';
}
if (empty($rows))
{
$problem = TRUE;
echo '<p>You forgot to enter the row(s) for this event, Please hit the back button and fill in the missing information</p>';
}
if (empty($seat_nums))
{
$problem = TRUE;
echo '<p>You forgot to enter the seat number(s) of tickets you have for this event, Please hit the back button and fill in the missing information</p>';
}
if (empty($ask_price))
{
$problem = TRUE;
echo '<p>You forgot to enter your asking price, Please hit the back button and fill in the missing information</p>';
}
//************************** end top form checks **********************************
if (empty($fullname)) //check for phone contact number
{
$problem = TRUE;
echo '<p>You forgot to enter your name, please hit your back button and enter your name</p>';
}
if (empty($company)) //check for phone contact number
{
$problem = TRUE;
echo '<p>You forgot to enter your company, please hit your back button and correct the entry</p>';
}
if (empty($address1)) //check for phone contact number
{
$problem = TRUE;
echo '<p>You forgot to enter your address, please hit the back button and correct the mistake</p>';
}
if (empty($city)) //check for phone contact number
{
$problem = TRUE;
echo '<p>You forgot to enter city that you live in, please hit the back button and correct the error</p>';
}
if (empty($state)) //check for phone contact number
{
$problem = TRUE;
echo '<p>No state entered, please correct this</p>';
}
if (empty($zip)) //check for phone contact number
{
$problem = TRUE;
echo '<p>No zipcode entered, please correct this</p>';
}
if (empty($dphone)) //check for phone contact number
{
$problem = TRUE;
echo '<p>You forgot to enter your telephone number, please hit the back button and enter your phone number</p>';
}
if (empty($email))//check for email address
{
$problem = TRUE;
echo '<p>You forgot to enter your email address, Please hit the back button and fill in the missing information</p>';
}
elseif (!valid_email($email))//Check validity of email
{
$problem = TRUE;
echo '<p>Your email address is not correctly formatted, please push the back button and correct the error</p>';
}
//check to see if the required information is being filled out in the second part of the form
if (!$problem)
{ // If there weren't any problems send the email!
//prepare the name for the body in the email
$name = $prefix . ' ' . $fullname . '';
$name = ucwords(strtolower($name));
//setup the contact information from the form into one variable
$date = $monthinhand . ' ' . $dateinhand . ', '. $yearinhand;
$emonth = ucwords(strtolower($emonth));
//setup the rest of the information
$event_info = "<h3>The following information has been sent from the sell tickets form on Ticketretriever.com:</h3>";
$event_info .= "<strong><font color=\"#FF0000\">Event information</font></strong><br />";
$event_info .= "Event Name: <strong>$ename</strong><br />
Event Venue: <strong>$evenue</strong><br />
Event Month: <strong>$emonth $eday, $eyear</strong><br />
Number of Tickets in Hand: <strong>$num_tickets</strong><br />
Section(s): <strong>$section</strong><br />
Row(s): <strong>$rows</strong><br />
Seat #'s: <strong>$seat_nums</strong><br />
Asking Price: <strong>$ask_price</strong><br />
Tickets in Posession: <strong>$posession</strong><br />
Date in Possession: <strong>$date</strong><br />
Comments: $ecomments<br /><br />
<strong><font color=\"#FF0000\">Personal Information</font></strong><br />
Name: <strong>$name</strong><br />
Company: <strong>$company</strong><br />
Address: <strong><br />$address1<br />$address2</strong><br />
City: <strong>$city</strong><br />
State: <strong>$state</strong><br />
Email Address: <a href=\"mailto:$email\">$email</a> <br />
Daytime Number: <strong>$dphone</strong><br />Home Phone: <strong>$hphone</strong><br/>
Preferred Contact Method: <strong>$p_contact</strong><br>";
//print out this message for testing
$body .= $event_info;
//echo $body;
// Recipients
$mailTo = "rharris@webhumor.com"; // note the comma
// Copies
//$mailCc = "three@example.com";
//$mailBcc = "four@example.com";
// From
$mailFrom = $email;
$mailFromName = $fullname;
// Reply address
$mailReplyTo = "rharris@webhumor.com";
// Message subject and contents
$mailSubject = "Request to sell tickets to Ticketretriever.com";
$mailMessage = $body;
// Text message charset
$mailCharset = "windows-1252"; // must be accurate (e.g. "Windows - 1252" is invalid)
// Create headres for mail() function
$headers = "Content-type: text/html; charset=$mailCharset\r\n";
$headers .= "From: $mailFromName <$mailFrom>\r\n";
$headers .= "Reply-To: $mailReplyTo\r\n";
//$headers .= "Cc: $mailCc\r\n";
//$headers .= "Bcc: $mailBcc\r\n";
// Send mail
mail($mailTo, $mailSubject, $mailMessage, $headers);
header("Location: http://www.ticketretriever.com/tickets-complete.html");
;
}
}
///////////////////////////////////////////////////////////
// Funtions //
// //
///////////////////////////////////////////////////////////
function valid_email($email)
{
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
if (eregi($pattern, $email))
{
return true;
}
else
{
return false;
}
}
?>