PHP Form to send sender an email?

This is a discussion on "PHP Form to send sender an email?" within the PHP Forum section. This forum, and the thread "PHP Form to send sender an email? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 24th, 2007, 00:16
Junior Member
Join Date: Aug 2005
Location: New Zealand
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Form to send sender an email?

Firstly. let me say I am not wired for this coding business but the following is a generated form that works for me but I require additional code so the respondent automatically receives an email with a message (their email address appears in a field on the form)...

PHP: Select all

<?php
// Website Contact Form Generator 
// http://www.tele-pro.co.uk/scripts/contact_form/ 
// This script is free to use as long as you  
// retain the credit link  

// get posted data into local variables
$EmailFrom Trim(stripslashes($_POST['EmailFrom'])); 
$EmailTo "donations@evolutionrevolution.co.nz";
$Subject "Donation";
$Address Trim(stripslashes($_POST['FullName']));
$Address Trim(stripslashes($_POST['Address'])); 
$Phone Trim(stripslashes($_POST['Phone'])); 
$OneOffDonation Trim(stripslashes($_POST['OneOffDonation'])); 
$RegularDonation Trim(stripslashes($_POST['RegularDonation'])); 
$Investor Trim(stripslashes($_POST['Investor'])); 

// validation
$validationOK=true;
if (
Trim($EmailFrom)==""$validationOK=false;
if (!
$validationOK) {
  print 
"<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body "";
$Body .= "FullName: ";
$Body .= $FullName;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "OneOffDonation: ";
$Body .= $OneOffDonation;
$Body .= "\n";
$Body .= "RegularDonation: ";
$Body .= $RegularDonation;
$Body .= "\n";
$Body .= "Investor: ";
$Body .= $Investor;
$Body .= "\n";

// send email 
$success mail($EmailTo$Subject$Body"From: <$EmailFrom>");

// redirect to success page 
if ($success){
  print 
"<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
  print 
"<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Please help!

Many thanks

Last edited by karinne; Mar 26th, 2007 at 13:07. Reason: Please use [php]...[/php] tags when displaying PHP code!
Reply With Quote

  #2 (permalink)  
Old Mar 24th, 2007, 15:55
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,619
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: PHP Form to send sender an email?

Please explain "require additional code so the respondent automatically receives an email with a message".

If you want help, please be clear about what you're asking or people won't bother helping you.
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #3 (permalink)  
Old Mar 25th, 2007, 04:44
Junior Member
Join Date: Aug 2005
Location: New Zealand
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Form to send sender an email?

I felt I had been very clear. Which part confuses you?

Just so I can be clearer in future forum discussion.

I have solved this anyway by cutting and pasting some script I found elsewhere on the web.
Reply With Quote
  #4 (permalink)  
Old Mar 25th, 2007, 06:49
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,619
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: PHP Form to send sender an email?

well, this confused me:
"require additional code so the 1.respondent automatically receives an 2.email with a message".

1. respondent: the person who filled in the form or the email address the form is being sent to?
2. 'an email with a message': don't need to explain that one!

If you want help, be very very clear. or people switch off when reading your post and move on to the next thread. Long sentences are hard to follow, so instead of...

...I require additional code so the respondent automatically receives an email with a message (their email address appears in a field on the form)...

I would have done this...

A fills the form and submits it
the contents are sent as an email to B
I want A to receive an automatic confirmation saying:
"Hi A, got your message, thanks!!!!!!!!"

But never mind! perhaps I was just being slow and the important thing is that you've got it working...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #5 (permalink)  
Old Mar 26th, 2007, 05:38
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Form to send sender an email?

If it makes you feel better, spinal, I really didn't understand what was being asked either.
Reply With Quote
  #6 (permalink)  
Old Mar 26th, 2007, 13:06
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,619
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: PHP Form to send sender an email?

ok, phew! I thought I was alone....
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
autoresponder on form

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form send in email Bravo81 PHP Forum 20 Jan 17th, 2008 11:47
Form won't send to email? Inkers Web Page Design 3 Jan 22nd, 2007 16:11
how to send email in php manzil PHP Forum 1 Jul 30th, 2006 16:34
Send form details to an email address...please help! newbie44 JavaScript Forum 4 Oct 2nd, 2005 08:45
Send Email w/ Attachment from ASP form laundrymedia Classic ASP 3 Nov 7th, 2003 20:44


All times are GMT. The time now is 06:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43