Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML 5 form to PHP email script sends blank email with undefined variable error
    primarykey
    data
    text
    <p>I am new to both HTML 5 and especially PHP, I have been trying to get a test email sent to me with the information in the form. I get a blank email and when checking the Apache logs it shows undefined variable from the PHP form handler.</p> <p>HTML form:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="formstyleb.css"&gt; &lt;link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/&gt; &lt;script type="text/javascript" src="jquery-1.9.1.min.js"&gt;&lt;/script&gt; &lt;script src="jquery.validate.min.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="formemail.php" method="post" enctype="text/plain" id="contact"&gt; &lt;fieldset&gt; &lt;legend&gt;Your Contact Details:&lt;/legend&gt; &lt;div&gt; &lt;label for="author"&gt;Name:(Required)&lt;/label&gt; &lt;input name="author" class="required name" id="author" type="text" title="Please Enter Your Name!"&gt; &lt;/div&gt; &lt;div&gt; &lt;label for="email"&gt;Email Address:(Required)&lt;/label&gt; &lt;input name="email"class="required email" id="email" type="text" title="Please Enter a Valid email Address!"&gt; &lt;/div&gt; &lt;div&gt; &lt;label for="comment"&gt;Comment:&lt;/label&gt; &lt;textarea rows="12" id="message" name="comment"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div&gt; &lt;button type="submit" id="submit" value="Submit as Multipart/form-data"&gt; &lt;img src="submit1.jpg" alt="Submit"&gt; &lt;/button&gt; &lt;/div&gt; &lt;div&gt; &lt;button type="reset" id="reset"&gt; &lt;img src="resetrs.jpg" alt="reset"&gt; &lt;/button&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;script type="text/javascript" src="jqformval.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>PHP handler:</p> <pre><code>&lt;?php ini_set('display_errors',1); /*stops undefined index error*/ if(isset($_POST['email'],$_POST['author'],$_POST['comment'] )) { $email = $_POST['email']; $author = $_POST['author']; $visitor_email = $_POST['email']; $comment = $_POST['comment']; $comment = wordwrap($comment, 70); } $email_from = 'xxxx@yyyy.com'; $email_subject = "Form Submission"; $email_body = "Message from $author.\n". "The message reads:\n $comment". $to = "xxxx@yyyy.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; mail($to,$email_subject,$comment,$headers); header( "Location: Thank You.html" ); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload