Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

data missing in mail, send from Contact Us form

the mail() function

Moderators: macek, egami, gesf

data missing in mail, send from Contact Us form

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


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.

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

$mail_to = '';
$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';
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to');
window.location = 'contact.html';

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

Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.