Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP contact form validation
    primarykey
    data
    text
    <p>I was just wondering if anybody could please help if this PHP code would work for validating HTML contact form inputs. I followed a tutorial to create this PHP validation, but i'm not sure if it will work. I don't have a webhost yet to test it out, but if anybody has a server,I will really be appreciated if anybody could do me a favour &amp; try the code if you can send/receive email. Thank you!! I'm using jQuery Validation Plugin for validating the form on client-side and this is the tutorial <a href="http://www.youtube.com/watch?v=rdsz9Ie6h7I" rel="nofollow">http://www.youtube.com/watch?v=rdsz9Ie6h7I</a><br> HTML form:</p> <pre><code>&lt;form action="contact.php" method="post"&gt; &lt;label for="yourname"&gt;Your Name:&lt;/label&gt; &lt;input type="text" name="YourName"/&gt; &lt;label for="youremail"&gt;Your Email:&lt;/label&gt; &lt;input type="text" name="YourEmail" /&gt; &lt;label for="yourmessage"&gt;Your Message:&lt;/label&gt; &lt;textarea name="YourMessage"&gt;&lt;/textarea&gt; &lt;fieldset&gt; &lt;input type="submit" id="submit" value="Send"/&gt; &lt;input type="reset" id="reset" value="Reset"/&gt; &lt;/fieldset&gt; PHP Code: &lt;?php /* Subject and Email Variables */ $emailSubject = 'Email from site visitor'; $webMaster = 'YourEmail@mail.com'; /* Getting Form Data Variables */ $nameField = $_POST['YourName']; $emailField = $_POST['YourEmail']; $messageField = $_POST['YourMessage']; $body = &lt;&lt;&lt;EOD &lt;br&gt;&lt;hr&gt;&lt;br&gt; Name: $YourName &lt;br&gt; Email: $YourEmail &lt;br&gt; Message: $YourMessage &lt;br&gt; EOD; $headers = "From: $YourEmail\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); $theResults = &lt;&lt;&lt;EOD &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;p style="font-size:12px;font-family:Tahoma,Verdana;"&gt;Thanks for your Message.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; EOD; echo "$theResults"; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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