Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Multi-form Trouble
    primarykey
    data
    text
    <p>Hello Fellow Stackers,</p> <p>New to PHP and I am putting together a multipage form from pre-built code.</p> <p>Basically the user selects as many checkboxes as they want... then the form submits to this secondary page. This secondary page echo's the checkboxes they chose at the top of the page via <code>$check</code>.. then they can enter their contact information and all of the information gets submitted via form, along with the <code>$check</code> information.</p> <p>Everything is working perfectly except <code>$check</code> isn't being entered into the form message, but it works up at the top of the page, displaying which options the user inputted. </p> <p>Any help is appreciated!</p> <pre><code>&lt;?php $emailOut = ''; if(!empty($_POST['choices'])) { foreach($_POST['choices'] as $check) { echo $check; //echoes the value set in the HTML form for each checked checkbox. //so, if I were to check 1, 3, and 5 it would echo value 1, value 3, value 5. //in your case, it would echo whatever $row['Report ID'] is equivalent to. $emailOut .= $check."\n"; //any output you want } } $errors = ''; $myemail = 'test@myemailHERE.com';//&lt;-----Put Your email address here. if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; } if( empty($errors)) { $to = $myemail; $email_subject = "Contact form submission: $name"; $email_body = "You have received a new message. $check ". " Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message \n $emailOut"; $headers = "From: $myemail\n"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header('Location: contact-form-thank-you.html'); } ?&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.
 

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