Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <h1>✓ EDIT (actual code used for successful submission)</h1> </blockquote> <hr> <h2>HTML form</h2> <pre><code>&lt;form id="contact_form" action="mailer.php" method="post"&gt; &lt;div class="message" style="display:none"&gt;&lt;div id="contact_alert" class="alert"&gt;&lt;/div&gt;&lt;/div&gt; &lt;label for="name"&gt;Name:&lt;/label&gt; &lt;input type="text" name="name" id="name" class="full-width help" title="Insert your name" /&gt; &lt;label for="email"&gt;Email:&lt;/label&gt; &lt;input type="email" name="email" id="email" class="full-width help" title="Insert your email" /&gt; &lt;label for="message"&gt;Message:&lt;/label&gt; &lt;textarea name="message" id="message" cols="30" rows="7" class="full-width help" title="Insert your message"&gt;&lt;/textarea&gt; &lt;input type="submit" value="Submit" class="button" /&gt; &lt;/form&gt; </code></pre> <h2>Mail handler</h2> <pre><code>&lt;?php $to = "email@example.com"; $subject = "Hi Nick, this is ".$_POST['name']; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $headers = 'From: '.$_POST['email'].'' . "\r\n" . 'Reply-To: '.$_POST['email'].'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $body = $message; mail($to, $subject, $body, $headers ); header('Location: http://www.example.com/thank-you'); // commented out for testing purposes. // Email was sent and received successfully // echo "Success"; ?&gt; </code></pre> <hr> <hr> <blockquote> <h1>✓ Original answer (Aug. 14, 2013)</h1> </blockquote> <hr> <p><strong>This</strong> => <code>enctype="text/plain"</code> should not be used inside <code>&lt;form&gt;</code> elements, and that is why you were having problems.</p> <h2>Try it with this reformatted form:</h2> <pre><code>&lt;form id="contact_form" action="mailer.php" method="post"&gt; &lt;div class="message" style="display:none"&gt;&lt;div id="contact_alert" class="alert"&gt;&lt;/div&gt;&lt;/div&gt; &lt;label for="name"&gt;Name:&lt;/label&gt; &lt;input type="text" name="name" id="name" class="full-width help" title="Insert your name" /&gt; &lt;label for="email"&gt;Email:&lt;/label&gt; &lt;input type="email" name="email" id="email" class="full-width help" title="Insert your email" /&gt; &lt;label for="message"&gt;Message:&lt;/label&gt; &lt;textarea name="message" id="message" cols="30" rows="7" class="full-width help" title="Insert your message"&gt;&lt;/textarea&gt; &lt;input type="submit" value="Submit" class="button" /&gt; &lt;/form&gt; </code></pre> <hr> <hr> <p>I replaced this:</p> <pre><code>&lt;form id="contact_form" action="mailer.php" method="post" enctype="text/plain"&gt; /--------------------/ </code></pre> <p>with this:</p> <pre><code>&lt;form id="contact_form" action="mailer.php" method="post"&gt; </code></pre> <p>And this is <strong>invalid:</strong></p> <pre><code>&lt;a href="thank-you"&gt;&lt;input type="button" value="Submit" class="button" /&gt;&lt;/a&gt; </code></pre> <p>This is <strong>valid:</strong></p> <pre><code>&lt;a href="thank-you.html"&gt;Click here&lt;/a&gt; </code></pre> <p>As is this is also valid:</p> <pre><code>&lt;input type="button" value="Submit" class="button" /&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.
    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