Hello,
I recently took over development for a non-profit organization that has had some PHP programming in place for a couple of years. I’m pretty positive the developer prior to me spliced a number of code snippets together to create the DB management tools and form elements. In trying to help them clean it up I am running in to a recurring error where after a client posts their information to be collected by the DB there is a message that displays telling them that the reservation has been received and asks if they would like to make another. This message only displays after I refresh the page. When I submit a test entry all I get is a blank page and then once I refresh the message then displays.
This is the code I am working with -
[php]} elseif ($_GET[‘confirm’] == “yes”){
if ($indb != “0”){
echo “<div style=“font-size:14px;”>Your reservation is confirmed.
<a href=“reservations.php?tab=1”>Make another one?”;
}else{
$sql=“INSERT INTO pf_reservations (id, email, date, month, day, year, tour_1, tour_2, tour_3, tour_4, organization, contact_name, contact_number, grade, students, teachers, parents, lunch, toppings, note, payment) VALUES (null, '”.$_SESSION[email]."’, ‘".$_SESSION[ds]."’, ‘".$_SESSION[month]."’, ‘".$_SESSION[day]."’, ‘".$_SESSION[year]."’, ‘".$_SESSION[tour1]."’, ‘".$_SESSION[tour2]."’, ‘".$_SESSION[tour3]."’, ‘".$_SESSION[tour4]."’, ‘".$_SESSION[organization]."’, ‘".$_SESSION[name]."’, ‘".$_SESSION[phone]."’, ‘".$_SESSION[grade]."’, ‘".$_SESSION[students]."’, ‘".$_SESSION[teachers]."’, ‘".$_SESSION[parents]."’, ‘".$_SESSION[lunch]."’, ‘".$_SESSION[toppings]."’, ‘".$_POST[note]."’, null)";
$result=mysql_query($sql) or die('Error, query failed. ' . mysql_error());
if($_SESSION[‘id’] != “”){[/php]
Notice the echo statement is what creates the thank you.
In turn, after submission the client is supposed to receive an email including their itinerary for their visit and the admin responsible for overseeing these visits should receive a mail as well. Here is the mail code I am currently working with -
[php]$subject = “Pizza Farm Reservation Info”;
$message = "
Dear $_SESSION[name],
Thanks for scheduling a Pizza Farm tour at Harvest Farm!
Date of reservation: $emaildate
Time: $ctour
Group size: $total_num
Your Tour Itinerary:
$itin
Upon your arrival at Harvest Farm, please check in at the front office. We will accept payment at that time.
See you soon!
Sincerely,
Harvest Farm
<img src=“http://www.harvestfarm.net/pizza_farm/images/emaillogo.jpg”>
<a href=“http://www.harvestfarm.net”>www.harvestfarm.net | <a href=“http://www.harvestfarm.net/pizza_farm/reservations.php?echeck=$_SESSION[email]&tab=2”>View Reservation";
mail( “$_SESSION[email]”, “$subject”, “$message”, “From: [email protected]\n” . “MIME-Version: 1.0\n” . “Content-type: text/html; charset=iso-8859-1”);
$subject2= “Pizza Farm Reservation”;
$message2= "
Date of reservation: $emaildate
Time: $ctour
Group size: $total_num
Your Tour Itinerary:
$itin
$_SESSION[organization];
$_SESSION[name];
$_SESSION[phone];
$_SESSION[email];
$_SESSION[grade];
$_SESSION[students];
$_POST[note];
";
mail( "[email protected]", "$subject2", "$message2", "From: $_SESSION[email]\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1");
echo "
<div style=“font-size:14px;”>Your reservation has been confirmed and an email with the details of your reservation has been sent to you (it may be in the Bulk folder of your email account).
I appreciate any and all help, this is the best PHP forum I have been a part of.