wiredphp Posted January 28, 2013 Share Posted January 28, 2013 Hi, I need tips and sugestions for form that I crated, just basic stuff. Also there is couple things that I need to do: 1) when submitted, form should to print message that form is sent, or if something is not ok, to display error mesage, everything on same page example, contact.php 2) now, when form is sent I recive it on email, but feedback field, textarea give me html tags for new line and something like that here is the code, please help: <?php if(empty($_POST["name"])) { die("Please provide valid name"); } ?> <?php if(is_numeric($_POST["name"])) { die("Please provide valid name"); } ?> <?php $email = $_POST["email"]; if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) { die("E-mail address not valid"); }; ?> <?php if(empty($_POST["subject"])) { die("Plese enter a subject."); } ?> <?php if(!isset($_POST['submit'])) { $ToEmail = 'xxx@yahoo.com'; $EmailSubject = 'Pitanje sa xxx.com'; $mailheader = "From :". $_POST["email"]. "\r\n"; $mailheader .= "Reply to :". $_POST["email"]. "\r\n"; $mailheader .= "Ova poruka sadrzi pitanje postavljeno na www.xxxx.com \r\n"; $MESSAGE_BODY = "Ime : " .$_POST["name"]." \r\n"; $MESSAGE_BODY .= "Email : " .nl2br($_POST["email"])." \r\n"; $MESSAGE_BODY .= "Naslov : " .$_POST["subject"]." \r\n"; $MESSAGE_BODY .= "Poruka : " .nl2br($_POST["feedback"])." \r\n"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); echo "Vasa poruka je uspjesno poslana! Kliknite <a href=\"index.html\">ovde</a> za pocetnu stranu "; }; ?> Quote Link to comment https://forums.phpfreaks.com/topic/273734-contact-form/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.