Newbie - code to send copy of web form to senders email too
Posted: Wed Oct 08, 2014 4:41 am
Hi
First time post. I have read online and there are so many different answers I do not know which to choose.
I have a form on a website which works fine as it is.
I just want to add a function that when the the visitor clicks submit they also get a copy of the email as well. I am not sure where to put a cc to the email address entered
This is the code I have:
Then the send file is
I kind of understand what is going on but am not proficient enough.
Any help much appreciated.
Rich
First time post. I have read online and there are so many different answers I do not know which to choose.
I have a form on a website which works fine as it is.
I just want to add a function that when the the visitor clicks submit they also get a copy of the email as well. I am not sure where to put a cc to the email address entered
This is the code I have:
Code: Select all
<p>Please read through our terms of business below. If you are happy with them and understand them please complete your details and press the agree button. We will email confirmation of receipt</p>
<div class="content_image">
<img src="images/questionnaire.jpg" alt="" width="350" height="225" />
</div>
<form id="questionnaire" method="post" action="terms-of-business-send.php" name="questionnaire">
<fieldset>
<div>
<label>Your Full Name:</label><br />
<input type="text" id="c_name1" name="c_name1" class="qfield clear" />
</div>
<div>
<label>Your Email:</label><br />
<input type="text" id="email" name="email" class="qfield clear" />
</div>
<div>
<label>Your Contact Tel:</label><br />
<input type="text" id="tel" name="tel" class="qfield clear" />
</div>
</fieldset>
<fieldset>
<ol>
<li>
<h2>I agree I have read and understood the terms of business</h2>
<input type="radio" name="q1" value="1" /> yes I agree<br />
</li>
</ol>
<div>
</div>
</fieldset>
<input type="submit" value="Agree">
<input type="reset" value="Reset">
<h4 id="error">There were errors on the form, please make sure your name and email have been filled out correctly.</h4>
</form>Then the send file is
Code: Select all
<?php
$c_name1 = $_POST['c_name1'];
$email = $_POST['email'];
$tel = $_POST['tel'];
$q1 = $_POST['q1'];
//$to = 'enquiries@email.net';
$to = 'enquiries@cemail.net';
$subject = 'Terms of Business Completed';
$msg = "$c_name1 has completed a Terms of Business from.\n\n" .
"Their email is: $email\n" .
"Their contact number is: $tel\n" .
"-----------------------------\n\n" .
"1: $q1\n\n" .
"Terms of business copy here" .
"-----------------------------\n" .
" END OF FORM -------\n" .
"-----------------------------\n\n";
mail($to, $subject, $msg, 'From: website Terms of Business Form');
echo '<h2>Thanks for confirming our Terms of Business ' . $c_name1 . '</h2>';
?>Any help much appreciated.
Rich