Note that there are some explanatory texts on larger screens.

plurals
  1. POSend email to address from form input
    primarykey
    data
    text
    <p>I have a pretty standard contact form with inputs for name, email address and phone number. As well as sending the email to the specified email address as per a standard form,</p> <pre><code>$to = 'diysoakwells@hotmail.com'; </code></pre> <p>I would also like to send the email to the user using the address from the email address input from the form. I was thinking using the post variable from the email input like this would work:</p> <pre><code>$to = 'diysoakwells@hotmail.com', $email; </code></pre> <p>but no luck. Can someone point me in the right directiona and are there any security risks in using this approach? I ultimately aim to provide the user with a checkbox that if checked sends a copy of the email to themselves.</p> <p>Here is a link to my form</p> <p><a href="http://www.diysoakwells.com.au/cart.php" rel="nofollow">http://www.diysoakwells.com.au/cart.php</a></p> <p>Thankyou in advance : )</p> <pre><code>&lt;?php include_once("wsp_captcha.php"); if(WSP_CheckImageCode() != "OK") { header('location:/form-rejected.php'); die(); } $to = 'diysoakwells@hotmail.com'; $subject = 'Order Inquiry'; $jcitems = " &lt;p&gt;&lt;b&gt;ORDER:&lt;/b&gt;&lt;/p&gt;&lt;p&gt; " . $_POST['jcitems']."&lt;p/&gt;" . "&lt;p&gt;&lt;b&gt;Total:&lt;/b&gt; $" . $_POST['jctotal']."&lt;/p&gt;"; $time = date ("h:i A"); $date = date ("l, F jS, Y"); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= 'From: inquiry@diysoakwells.com' . "\r\n" . 'Reply-To: noreply@diysoakwells.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $name = $_POST['name']; $phone = $_POST['phone']; $emaile = $_POST['emaile']; $textbox = $_POST['textbox']; $text = "&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;b&gt;Message:&lt;/b&gt;\n$textbox&lt;/p&gt;&lt;p&gt;This form was submitted on Your Web Site on \n $date at\n $time&lt;/p&gt;&lt;p&gt;&lt;b&gt;Customers Email Address:&lt;/b&gt; $emaile&lt;/p&gt;&lt;p&gt;&lt;b&gt;Customers Name:&lt;/b&gt; $name &lt;/p&gt;&lt;p&gt;&lt;b&gt;Customers Phone Number:&lt;/b&gt; $phone &lt;/p&gt;&lt;/html&gt; &lt;/body&gt;"; $body = $text . $jcitems; mail($to, $subject, $body, $headers); Header('Location: ../form-accepted.php'); ?&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.
 

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