Note that there are some explanatory texts on larger screens.

plurals
  1. POExtracting HTML Form TextArea in PHP
    primarykey
    data
    text
    <p>Need help in understanding why the textarea ("message" below) field in the HTML5 form is not being grabbed from the PHP code (used to create email).</p> <p>HTML Code (French):</p> <pre><code> &lt;form method="post" action="contact.php"&gt; &lt;fieldset&gt; &lt;p class="tight" style="font-size: 10pt; text-align: center;" &gt;Message pour des demandes de renseignements d&amp;apos;ordre &lt;br /&gt; g&amp;eacute;n&amp;eacute;ral seulement. Veuillez utiliser demande formulaire situ&amp;eacute; &lt;br /&gt; sur la page Service pour commencer.&lt;/p&gt; &lt;label&gt;&lt;span&gt;Nom&lt;/span&gt; &lt;input class="inputcontact" name="name" type="text" /&gt;&lt;/label&gt; &lt;label&gt;&lt;span&gt;Courrier &lt;br /&gt;&amp;Eacute;lectronique&lt;/span&gt; &lt;input class="inputcontact" name="email" type="text" /&gt;&lt;/label&gt; &lt;label&gt;&lt;span&gt;T&amp;eacute;l&amp;eacute;phone&lt;/span&gt; &lt;input class="inputcontact" name="telephone" type="text" /&gt;&lt;/label&gt;&lt;br /&gt; &lt;label class="labelleft" for="message"&gt; MESSAGE &lt;textarea name="message" rows="8" cols="45"&gt; &lt;/textarea&gt;&lt;/label&gt; &lt;/fieldset&gt; &lt;input class="submit" type="submit" value="ENVOYER" /&gt; &lt;/form&gt; </code></pre> <p>PHP Code (contact.php):</p> <pre><code> &lt;?php /* Set e-mail recipient */ $myemail = "xxxxxx@gmail.com"; /* Check all form inputs using check_input function */ $yourname = check_input($_POST['name']); $email = check_input($_POST['email']); $telephone = check_input($_POST['telephone']); $messaage = check_input($_POST["message"]); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* Let's prepare the message for the e-mail */ $subject ="Comment received from website"; $content = "Hello! The contact form from the website has been submitted by: Name: $yourname E-mail: $email Telephone: $telephone Message:$message "; /* Send the message using mail() function */ mail($myemail, $subject, $content); /* Redirect visitor to the thank you page */ header('Location: thanks.html'); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem &amp;&amp; strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?&gt; &lt;html&gt; &lt;body&gt; &lt;b&gt;Please correct the following error:&lt;/b&gt;&lt;br /&gt; &lt;?php echo $myError; ?&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php exit(); } ?&gt; </code></pre>
    singulars
    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.
    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