View Single Post
Old 04-24-2008, 04:10 AM   #5 (permalink)
Cerilia
Registered User
 
Cerilia's Avatar
 
Join Date: Apr 2008
Location: England
Posts: 11
OS: XP Pro SP2


Re: Driving me crazy!

Ok I did a search on these boards in an attempt to get the correct code in place... I have however come up against a problem (not the one that doesn't make it work, that still exists!) I dont know how to incorporate any of the other fields I've got...'how did they hear about us' fields!

I know I shouldn't expect a message as such, but an email at the least!

Anyone????

Current HTML with previous advice taken.

Code:
<form id="rwform" method="post" action="sendmail.PHP">

<div class="contactform">
<label for="name">Name</label>
<input  type="text" name="name" value="" />
</div>

<div class="contactform">
<label for="address">Address</label>
<input type="text" name="address" value="" />
</div>

<div class="contactform">
<label for="telephone">Telephone</label>
<input type="text" name="telephone" value="" />
</div>

<div class="contactform">
<label for="email">Email Address:</label>
<input  type="text" name="email" value="" />
</div>

<div class="contactform">
<label for="enquiry">Enquiry:</label>
<textarea name="enquiry" id="enquiry" rows="5" cols="25"></textarea>
</div>

<div class="contactform">
<label for="hearaboutus">How did you hear about us?</label>
<input type="checkbox" name="websearch" /> Web Search<br />
<input type="checkbox" name="recommended" class="threepxfix" /> Recommended<br />
<input type="checkbox" name="mag_ad" class="threepxfix" /> Magazine Advert<br />
<input type="checkbox" name="flyer" class="threepxfix" /> Flyer<br />
</div>
<div style="margin-left: 150px;">
<input type="submit" value="Submit" onSubmit="this.disabled=true;" /> <input type="reset" value="reset" />
</div>

</form>
New Code as found on this forum: 'Including comments'
Code:
<?php
// THESE ARE THE VARIABLES THAT YOU NEED TO EDIT!

$sendto = "myemail@host.co.uk"; // for example: username@usershost.com
$gotopage = "http://www.example.com/thankyou.html"; // for example: http://www.yoursite.com/thankyou.html

// end editable variables


  $_POST = array_map('strip_tags', $_POST);
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  
// let's format them
  $message = "Enquiry:" . "\n\n" . $message;
  $subject = "Email From Website - " . $name;

// this will show you who it's from AND will blind carbon-copy the message to them
  $headers .= 'From: ' . $name . '<' . $email . '>' . "\r\n";
  $headers .= 'Bcc: ' . $name . '<' . $email . '>' . "\r\n";

// let's check if that email is valid or not!
// if it's valid - send the email

        mail($sendto, $subject, $message, $headers);
        header("Location: $gotopage");

?>

Last edited by Cerilia : 04-24-2008 at 04:18 AM.
Cerilia is offline   Reply With Quote