Jump to content

PHP Form Handler Help


croz27

Recommended Posts

Hi Y'all

 

I have a contact form page with a contact-handler.php for emailing the details to my email address.

 

I have the site uploaded on the net for the php and submission of the message fields to work and it seems to submit the message fine (simple contact form... name, email and message) but i never receive the email of the users message??

 

I have searched this forum before i posted this and there was one message on this topic however i could not make sense of the reply.. guy typs lke this lnguage wit misn words? madness. Anyways i know a guy mentioned gmail and yahoo might be backlist but surely not for days? the email is not in my spam folder either..

 

heres the snippet of my code, massively appreciate any help.

 

<?php 
$errors = '';
$myemail = 'croz27@gmail.com';
if(empty($_POST['name'])  || 
   empty($_POST['email']) || 
   empty($_POST['message']))
{
    $errors .= "\n Error: all fields are required";
}

$name = $_POST['name']; 
$email_address = $_POST['email']; 
$message = $_POST['message']; 

if (!eregi(
"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", 
$email_address))
{
    $errors .= "\n Error: Invalid email address";
}

if( empty($errors))
{
$to = $myemail; 
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message"; 

$headers = "From: $myemail"; 
$headers .= "Reply-To: $email_address";

mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
} 
?>



 

Thanks for any input.

 

ps. I have left in my real email address incase gmail has any conflicts with this ...

 

croz27

Link to comment
Share on other sites

Can you maybe leave that (header location) out of your code and test it,

If your not sending mail, I assume you will get a specific error (which shows on the initial page)

The error stuff your testing now only checks if what the users inputs is valid, but what you want to know also if your able to sent mail even if that's correct.

Link to comment
Share on other sites

Hi,

 

First of all thanks very much for your reply, any help is very appreciated as this is killing my brain!

 

I took the location out and recieved no error and still no email...

 

any other ideas? It seems to function properly and i thought it may be my gmail stopping it but i get no email even in the spam folder.

 

Thanks,

 

croz27

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.