Hi.
I’m creating a simple email form on a local development environment.
I’m testing it both locally and on a hostgator shared host.
Upon submitting the form, I’m getting the white screen. This happens on both environments
After some googling, I came across advice to turn on error reporting, either in the file or in php.ini.
So locally in my php file that processes the form,
I have pasted these lines:
ini_set('display_errors', 1);
error_reporting(E_ALL);
I have uncommented this line from my php.ini, before restarting apache:
error_reporting = E_ALL & ~E_NOTICE
Unfortunatly, this makes no difference. I’m still getting the white screen with no errors being reported.
How can I further diagnose the problem?
What is likely to be going wrong?
Here is a paste of my form processing code:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
// Mail header removal
function remove_headers($string)
{ $headers = array( "/to\\:/i", "/from\\:/i", "/bcc\\:/i", "/cc\\:/i",
"/Content\\-Transfer\\-Encoding\\:/i",
"/Content\\-Type\\:/i", "/Mime\\-Version\\:/i" );
$string = preg_replace($headers, '', $string); return strip_tags($string);
}
$name = remove_headers($_POST['name']);
$email = remove_headers($_POST['email']);
$subject = remove_headers($_POST['subject']);
$message = remove_headers($_POST['message']);
// Build the email (replace the address in the $to section with your own)
$to = "me@example.com";
$email = "New message: $subject";
$message = "$email said: $message";
$headers = "From: $email";
// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);
?>