Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with my PHP Form
    primarykey
    data
    text
    <p>I can't get the value of the checkbox, the recipient(Administrator or Content Editor), to display it displays "Array" or "A". Also the page redirects automatically without the form first appearing. How do I rectify this? Here is my code:</p> <p>contact.php</p> <pre><code> &lt;?php $errnam = ""; $errmail = ""; $errsub = ""; $errrec = ""; $hasErrors = false; if(isset ($_POST['submitted'])){ $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $recipient = $_POST['recipient']; $message = $_POST['message']; if(preg_match("/^[\w\-'\s]/", $_POST['name'])){ $name = $_POST['name']; } else{ $errnam ='&lt;strong&gt;Please enter a name.&lt;/strong&gt;'; $hasErrors = true; } if (preg_match("/^[\w.-_]+@[\w.-]+[A-Za-z]{2,6}$/i", $email)){ $email = $_POST['email']; } else{ $errmail = '&lt;strong&gt;Please enter a valid email.&lt;/strong&gt;'; $hasErrors = true; } if(preg_match("/^[\w\-'\s]/", $_POST['subject'])){ $subject = $_POST['subject']; } else{ $errsub = "&lt;strong&gt;Please enter a subject.&lt;/strong&gt;"; $hasErrors = true; } if (!empty($_POST['recipient'])) { for ($i=0; $i &lt; count($_POST['recipient']);$i++) { $recipient = $_POST['recipient']; } }else{ $errrec = "&lt;strong&gt;Please select a recipient&lt;/strong&gt;"; $hasErrors = true; } $message = $_POST['message']; } if ($hasErrors){ echo "&lt;strong&gt;Error! Please fix the errors as stated.&lt;/strong&gt;"; }else{ header("Location: form.php?name=".$name."&amp;email=".$email."&amp;subject=".$subject. "&amp;recipient=".$recipient. "&amp;message=".$message); exit(); } ?&gt; </code></pre> <p>form.php</p> <pre><code>&lt;?php $name = $_GET['name']; $email = $_GET['email']; $subject = $_GET['subject']; $recipient = $_GET['recipient']; $message = $_GET['message']; echo "&lt;h2&gt;Thank You&lt;/h2&gt;"; echo "&lt;p&gt;Thank you for your submission. Here is a copy of the details that you have sent.&lt;/p&gt;"; echo "&lt;strong&gt;Your Name:&lt;/strong&gt; ".$name. "&lt;br /&gt;"; echo "&lt;strong&gt;Your Email:&lt;/strong&gt; ".$email. "&lt;br /&gt;"; echo "&lt;strong&gt;Subject:&lt;/strong&gt; ".$subject. "&lt;br /&gt;"; echo "&lt;strong&gt;Recipient:&lt;/strong&gt;" .$recipient. "&lt;br /&gt;"; echo "&lt;strong&gt;Message:&lt;/strong&gt; &lt;br /&gt; " .$message; ?&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