mR-mONKEY Posted September 1, 2008 Share Posted September 1, 2008 Hello, I am a novice at php and currently trying to edit a e-mail form. I have 2 fields that go to the $message sections of the e-mail, i simply want to insert a <br> inbetween them. Tried everything i could think probaly something really simple any help would be greatly appreciated. my codes below <?php error_reporting(E_NOTICE); function valid_email($str) { return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; } if($_POST['first_name']!='' && $_POST['last_name']!='' && $_POST['e_mail']!='' && $_POST['date']!='' && valid_email($_POST['e_mail'])==TRUE && strlen($_POST['message1'])>30) { $to = '[email protected]'; $headers = 'From: '.$_POST['e_mail'].''. "\r\n" . 'Reply-To: '.$_POST['e_mail'].'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $subject = "MOT Booking"; $message1 = htmlspecialchars($_POST['message1']); $date = htmlspecialchars($_POST['date']); $message = "Message: $message1 '<br>' Date: $date"; if(mail($to, $subject, $message, $headers)) { echo 'Thank you '.$_POST['first_name'].'. Your message was sent'; } else { echo "Message not sent. Please make sure you're not running this on localhost and also that you are allowed to run mail() function from your webserver"; } } else { echo 'Please make sure you filled all the required fields, that you entered a valid email and also that your message contains more then 30 characters.'; } ?> Thanks Jon Link to comment https://forums.phpfreaks.com/topic/122206-e-mail-form/ Share on other sites More sharing options...
valtido Posted September 1, 2008 Share Posted September 1, 2008 insert what inbetween ? could u b more specific ? thnx Link to comment https://forums.phpfreaks.com/topic/122206-e-mail-form/#findComment-630942 Share on other sites More sharing options...
knowj Posted September 1, 2008 Share Posted September 1, 2008 $message = "Message: $message1 \n\n Date: $date"; im guessing you mean line break \n will provide this as long as it is within "" and not ''. Link to comment https://forums.phpfreaks.com/topic/122206-e-mail-form/#findComment-630947 Share on other sites More sharing options...
mR-mONKEY Posted September 1, 2008 Author Share Posted September 1, 2008 ah sorry valtido i did put a break rule tag in but it inserted the break rule in my post. All i wanted was the date and message to have a break rule inbetween \n worked thanks very much for the help Link to comment https://forums.phpfreaks.com/topic/122206-e-mail-form/#findComment-630961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.