• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Php mail forms


Senior Member
Can't help you out without seeing the actual php.

Your HTML form could be a little more semantic though.
<form action="contact.php" method="post"> 
  <div><label for="cf_name">Your name</label> 
  <input type="text" name="cf_name" if="cf_name" /></div>

  <div><label for="cf_email">Your e-mail<label>
  <input type="text" name="cf_email" id="cf_email" /></div>
  <div><label for="cf_phone">Your phone number</label>
  <input type="text" name="cf_phone" id="cf_phone" /></div>

  <div><label for="cf_message">Message</label> 
  <textarea name="cf_message" id="cf_message" cols="50" rows="20"></textarea></div>

  <div><input type="submit" value="Send"></div>
Along with some css to fix all the removed <br /> tags.
form div, label {   display:block; }
Edit: Arguably you could replace those divs by paragraphs, or breaklines like you had, for disabled css. You should add those labels (and id's) though.


Senior Member
<?php$field_name = $_POST['cf_name'];$field_email = $_POST['cf_email'];$field_message = $_POST['cf_message'];$field_phone = $_POST['cf_phone'];$mail_to = 'mrp2049@htomail.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: '.$cf_email."\r\n";$headers .= 'Reply-To: '.$cf_email."\r\n";$mail_status = mail($mail_to, $subject, $phone, $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 = 'contacteng.html';	</script><?php}else { ?>	<script language="javascript" type="text/javascript">		alert('Message failed. Please, send an email to fontani@claimcom.it');		window.location = 'contacteng.html';	</script><?php}?>


Senior Member
Also in your mail function I'm not sure if that $phone is legit, but I may be wrong. It's not necessary though, right? It's shown in the $body_message anyway.

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


Active Member
I had a 12 hour delay the other day 4 seperate times. But glad you got it sorted, didn't think the variable $phone in the mail function was err...exactly correct. :)