data missing in mail, send from Contact Us form

the mail() function

Moderators: macek, egami, gesf

mandeep2k9
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Jul 18, 2011 10:28 pm

data missing in mail, send from Contact Us form

Postby mandeep2k9 » Mon Jul 18, 2011 10:37 pm

Hi,

I am new to php, i have create contact us form in html and process the data with php. mail is sucessfully send every time to my desired email id. but the data is missing. i.e i am not getting the data feeded in contact us form in my mail.

will you please help me out.

please find the php script for the ref.

<?php
$field_name = $_POST['name'];
$field_company = $_POST['company'];
$field_phone = $_POST['phone'];
$field_email = $_POST['email'];
$field_message = $_POST['message'];

$mail_to = 'mymail@abc.com';
$subject = 'Message from a site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone: '.$field_phone."\n";
$body_message .= 'Message: '.$field_message;

$headers = 'From: '.$email."\r\n";
$headers .= 'Reply-To: '.$email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'contact.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to mymail@abc.com');
window.location = 'contact.html';
</script>
<?php
}
?>

Thanks
Mandeep Randhawa

Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron