Note that there are some explanatory texts on larger screens.

plurals
  1. POForm doesn't display
    primarykey
    data
    text
    <p>Can someone tell me why this is not displaying the form? If I go to the address that I have it hosted on, the page just displays "Your message has been sent. Thank you, ." It seems to just execute and display the last function.</p> <pre><code> &lt;?php function validateInput($data, $fieldName) { global $errorCount; if (empty($data)) { echo "\"$fieldName\" is a required field.&lt;br /&gt;\n"; ++$errorCount; $retval = ""; } else { // only clean up the input if it isn't empty $retval = trim($data); $retval = stripsplashes($retval); } return($retval); } function validateEmail($data, $fieldName) { global $errorCount; if (empty($data)) { echo "\"$fieldName\" is a required field.&lt;br /&gt;\n"; ++$errorCount; $retval = ""; } else { // only clean up the input if it isn't empty $retval = trim($data); $retval = stripsplashes($retval); $pattern = "/^[\w-]+(\.[\w-]+)*@" . "[\w-]+(\.[\w-]+)*" . "(\.[[a-z]]{2,})$/i"; if (preg_match($pattern, $retval) == 0) { echo "\"$fieldName\" is not a valid e-mail address.&lt;br /&gt;\n"; ++$errorCount; } } return($retval); } function displayForm($Sender, $Email, $Subject, $Message) { ?&gt; &lt;h2 style = "text-align:center"&gt;Contact Me&lt;/h2&gt; &lt;form name="contact" action="ContactForm.php" method="post"&gt; &lt;p&gt;Your name: &lt;input type="text" name="Sender" value="&lt;?php echo $Sender; ?&gt;" /&gt;&lt;/p&gt; &lt;p&gt;Your E-mail: &lt;input type="text" name="Email" value="&lt;?php echo $Sender; ?&gt;" /&gt;&lt;/p&gt; &lt;p&gt;Subject: &lt;input type="text" name="Subject" value="&lt;?php echo $Subject; ?&gt;" /&gt;&lt;/p&gt; &lt;p&gt;Message:&lt;br /&gt; &lt;textarea name="Message"&gt;&lt;?php echo $Message; ?&gt;&lt;/textarea&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="reset" value="Clear Form" /&gt;&amp;nbsp; &amp;nbsp;&lt;input type="submit" name="Submit" value="Send Form" /&gt;&lt;/p&gt; &lt;/form&gt; &lt;?php } $ShowForm = TRUE; $errorCount = 0; $Sender = ""; $Email = ""; $Subject = ""; $Message = ""; if (isset($_POST['Submit'])) { $Sender = validateInput($_POST['Sender'],"Your Name"); $Email = validateInput($_POST['Email'],"Your E-mail"); $Subject = validateInput($_POST['Subject'],"Subject"); $Message = validateInput($_POST['Message'],"Message"); if ($errorCount == 0) $ShowForm = FALSE; else $ShowForm = TRUE; } if ($ShowForm == TRUE) if ($errorCount&gt;0) {// if there were errors echo "&lt;p&gt;Please re-enter the form information below.&lt;/p&gt;\n"; displayForm($Sender, $Email, $Subject, $Message); } else { $SenderAddress = "$Sender &lt;$Email&gt;"; $Headers = "From: $SenderAddress\nCC: $SenderAddress\n"; // Substitute your own e-mail address for recipient@example.com $result = mail("recipient@example.com", $Subject, $Message, $Headers); if ($result) echo "&lt;p&gt;Your message has been sent. Thank you, " . $Sender . ".&lt;/p&gt;\n"; else echo "&lt;p&gt;There was an error sending your message, " . $Sender . ".&lt;/p&gt;\n"; } ?&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.
 

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