Jump to content

code to send web form to multiple address


trickslide

Recommended Posts

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 get a copy of the email as well.

This is the code I have:

 

<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 

 

<?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>';

?>

 

I kind of understand what is going on but am not proficient enough.

 

Any help much appreciated.

Rich

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.