https://vitamin-h.com/formSubmit_kamihai2024.php
(please specify the URL of the site on which you are experiencing the problem)
(Blank Screen)
(please share the FULL error message you see, if applicable)
Other Information
I have a weebly site with a form on it that calls a php file on my InfinityFree site, but instead of doing anything, it gives me a blank white screen with “?i=1” after the url. I’ve had several sites look at my code, and the general opinion is that the problem is on the server in how the php script is getting invoked when the form submits a post request to the server. It’s been suggested that I will likely need to involve the web hosting support to solve this.
Here is the code in question:
<?php
if(isset($_POST['email'])) {
// CHANGE THE TWO LINES BELOW
$email_to = "[email protected]";
$email_toa = "[email protected]";
$email_subject = "Kami-Con HAI 2024 - AMV Submission";
$conf_subject = "Kami-Con HAI 2024 - AMV Contest Confirmation";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please click BACK in your browser and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['handle']) ||
!isset($_POST['amv_category']) ||
!isset($_POST['youtube'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
if(!empty($_POST['first_name'])) {}
else{
died('First name is required.');
}
if(!empty($_POST['last_name'])) {}
else{
died('Last name is required.');
}
if(!empty($_POST['amv_title'])) {}
else{
died('Title of AMV is required.');
}
if(!empty($_POST['amv_song'])) {}
else{
died('Song Used is required.');
}
if(!empty($_POST['amv_artist'])) {}
else{
died('Song Artist is required.');
}
if(!empty($_POST['amv_anime'])) {}
else{
died('Animation sources are required.');
}
if(!empty($_POST['amv_link'])) {}
else{
died('AMV link is required.');
}
if(!empty($_POST['attending'])) {}
else{
died('Are you attending the convention? This answer is required.');
}
if(!empty($_POST['email'])) {}
else{
died('Email address is required.');
}
if(!isset($_POST['consent'])) {
died('You must check that you have read and understand the AMV League Rules and Criteria to submit a video.');
}
function IsChecked($chkname,$value)
{
if(!empty($_POST[$chkname]))
{
foreach($_POST[$chkname] as $chkval)
{
if($chkval == $value)
{
return true;
}
}
}
return false;
}
$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$handle = $_POST['handle']; // not required
$amv_title = $_POST['amv_title']; // required
$amv_category = $_POST['amv_category']; // required
$amv_song = $_POST['amv_song']; // required
$amv_artist = $_POST['amv_artist']; // required
$amv_anime = $_POST['amv_anime']; // required
$amv_link = $_POST['amv_link']; // required
$email_from = $_POST['email']; // required
$attending = $_POST['attending']; // required
$youtube = $_POST['youtube']; // not required
$consent = $_POST['consent']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z' .-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name: ".clean_string($first_name)." ".clean_string($last_name)."\n";
$email_message .= "Handle: ".clean_string($handle)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Title of AMV: ".clean_string($amv_title)."\n";
$email_message .= "Category: ".clean_string($amv_category)."\n";
$email_message .= "Song: ".clean_string($amv_song)." by ".clean_string($amv_artist)."\n";
$email_message .= "Anime Used: ".clean_string($amv_anime)."\n\n";
$email_message .= "Youtube: ".clean_string($youtube)."\n\n";
$email_message .= clean_string($amv_link)."\n\n\n";
$amv_category = strtoupper($amv_category);
$email_message .= clean_string($amv_category)."\n";
$email_message .= clean_string($amv_title)."\n";
$email_message .= "\"".clean_string($amv_song)."\""."\n";
$email_message .= clean_string($amv_artist)."\n";
$email_message .= clean_string($amv_anime)."\n";
$email_message .= "Editor: ".clean_string($handle)."\n\n";
$email_message .= "Attending? ".clean_string($attending)."\n\n";
$email_message .= "Full Name: ".clean_string($first_name)." ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n\n";
$email_message .= "Download: ".clean_string($amv_link)."\n";
$email_message .= "Streaming: ".clean_string($youtube)."\n\n";
$conf_message .="Thank you for your interest. We have received the following submission from you: \n\n";
$amv_category = strtoupper($amv_category);
$conf_message .= clean_string($amv_category)."\n";
$conf_message .= clean_string($amv_title)."\n";
$conf_message .= "\"".clean_string($amv_song)."\""."\n";
$conf_message .= clean_string($amv_artist)."\n";
$conf_message .= clean_string($amv_anime)."\n";
$conf_message .= "Editor: ".clean_string($handle)."\n\n";
$conf_message .= "Full Name: ".clean_string($first_name)." ".clean_string($last_name)."\n";
$conf_message .= "Email: ".clean_string($email_from)."\n\n";
$conf_message .= "Download: ".clean_string($amv_link)."\n";
$conf_message .= "Streaming: ".clean_string($youtube)."\n\n";
$conf_message .= "We will review this submission at our earliest convenience and contact you if there are any further issues.\n\n";
$conf_message .= "Regards,\n";
$conf_message .= "Annie Bowyer\n";
$conf_message .= "Vitamin H Productions\n";
$conf_headers = 'From: '.$email_toa."\r\n".
'Reply-To: '.$email_toa."\r\n" .
'X-Mailer: PHP/' . phpversion();
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $email_message, $headers);
mail($email_from, $conf_subject, $conf_message, $conf_headers);
header( 'Location: https://vitaminh.weebly.com/thankyou.html' ) ;
}
die();
?>```
If there's any other information you need, let me know.