HTML form returning raw PHP code -


i have form , contents mailed email address, problem i'm having anytime hit submit button, page shows raw php code , no email being sent. took out email address, have yahoo account in there testing purposes. running locally through wamp wordpress installed , have no issues wordpress. thoughts?

html

<form id="signup" autocomplete="on" method="post" name="contactform" action="http://localhost/contact-form-handler.php"> <div id="prayerrequest"></div><!-- end prayerrequest --> <textarea class="text" name="prayer" placeholder="* prayer request" required=""></textarea><br> <select name="title" class="dropdown" required="">     <option disabled="disabled" selected="selected">* title</option>     <option value="mr">mr.</option>     <option value="ms">ms.</option>     <option value="mrs">mrs.</option>     <option value="dr">dr.</option>     <option value="rev">rev.</option>     <option value="pastor">pastor</option> </select> <input type="text" class="multiple" name="first" placeholder="* first name" required=""> <input type="text" class="multiple" name="last" placeholder="* last name" required=""><br> <input type="email" class="full" name="email" placeholder="* email address" required=""><br> <input type="text" class="full" name="address" placeholder="* street address 1" required=""> <input type="text" class="full" placeholder="street address 2">  <input type="text" class="multiple" name="city" placeholder="* city" required=""> <button type="submit" class="submit">submit prayer request</button> <p>*required field</p>   

php

<?php  $errors = ''; $myemail = 'myemail@domain.com';//<-----put email address here. if(empty($_post['first'])  ||  empty($_post['email']) ||  empty($_post['prayer'])) { $errors .= "\n error: fields required"; }  $name = $_post['first'];  $email_address = $_post['email'];  $message = $_post['prayer'];   if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",  $email_address)) { $errors .= "\n error: invalid email address"; }  if( empty($errors)) { $to = $myemail;  $email_subject = "contact form submission: $name"; $email_body = "you have received new message. ". " here details:\n name: $first \n email: $email_address \n message \n        $prayer";   $headers = "from: $myemail\n";  $headers .= "reply-to: $email_address";  mail($to,$email_subject,$email_body,$headers); //redirect 'thank you' page header('location: contact-form-thank-you.html'); }  ?> <!doctype html public "-//w3c//dtd html 4.01 transitional//en"     "http://www.w3.org/tr/html4/loose.dtd">  <html> <head> <title>contact form handler</title> </head>  <body> <!-- page displayed if there error --> <?php echo nl2br($errors); ?>  </body> </html> 


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -