foreach ($_POST as $key => $value) { if ($value == "") { $value = "[]"; } if ($key != "submit") { $message .= $key . " - " . $value . "<br />\n"; } } $message .= "</body></html>\n"; $message .= "--{$mime_boundary}--\n\n"; sendEmail($to, $from, $subject, $message); echo "<html><body><script type=\"text/javascript\">parent.main_popupWindowCancel();</script></body></html>"; } ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// ////////////BEGIN SCRIPT EXECUTION BELOW////////////////////// ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// if (!isSSL()) { header("Location: logout.php"); } else { validateSession(); if (isset($_POST['submit'])) { sendFeedback(); } else { echoFrameHeader(); displayFeedbackPage(); echoFrameFooter(); } die; }
$eventVenue = filter_var($eventvenue, FILTER_SANITIZE_STRING); #sql insert query to insert event into the database $setEvent = "INSERT INTO `cbumobile`.`events` (\n `EventId` ,\n `EventTitle` ,\n `EventDescription` ,\n `Date` ,\n `Venue`\n )\n VALUES (\nNULL , '{$eventTitle}', '{$eventDescription}', '{$eventDate}', '{$eventVenue}'\n)"; if (isset($eventTitle) && isset($eventDescription) && isset($eventDate) && isset($eventVenue)) { $sendevent = mysqli_query($connection, $setEvent); if (isset($sendevent)) { $status = "Success"; $message = "The event has been stored successfully"; sendFeedBack($status, $message); } else { $status = "Fail"; $message = "Failed to store the event, try again."; sendFeedback($status, $message); } #ends inner if statement } else { $status = "Fail"; $message = "Please complete information about the event."; sendFeedback($status, $message); } #ends outer if statement mysqli_close($connection); function sendFeedBack($status, $message) { #returns the right feedback message #depending on what has happens $feedBack['Status'] = $status; $feedBack['Message'] = $message; $sendFeedBack[] = $feedBack; print json_encode($sendFeedBack); }