Mail Contact Form Info not working

the mail() function

Moderators: macek, egami, gesf

ipjuvares
New php-forum User
New php-forum User
Posts: 1
Joined: Sat Jul 28, 2012 10:59 pm

Mail Contact Form Info not working

Postby ipjuvares » Sat Jul 28, 2012 11:07 pm

Dear friends, I am a beginner in php and the template code which I have modified and am using, is giving up the error message irrespective of whether i submit the contact form without filling all the details or with all the details. Can someone please help me out with this? If needed i can post the javascript code and the html code i am using with this. here is the php code:

Code: Select all

<?php
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$name= isset($_POST['name']) ? $_POST['name'] : '';
$company= isset($_POST['company']) ? $_POST['company'] : '';
$telephone=isset($_POST['telephone']) ? $_POST['telephone'] : '';
$email=isset($_POST['email']) ? $_POST['email'] : '';
$message=isset($_POST['message']) ? $_POST['message'] : '';

if(empty($name) || empty($company) || empty($telephone) || empty($email) || empty($message)){
$errors=1;
$error.="You did not complete one or more fields, please go back and try again!";
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$name."
Company: ".$company."
Telephone: ".$telephone."
E-mail: ".$email."
Message: ".$message."
";
$message = stripslashes($message);
mail("xyz@xyz.com","Form Submitted at your website",$message,"From: xyz.com");
header('Refresh: 0; http://www.xyz.com/thanks.html');
}
?>

Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 0 guests