logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 02-25-2011, 06:50 PM   #1
higgs2585
 
Join Date: Feb 2011
Posts: 4
Default Submitting a form to email with php in dreamweaver

Hi,


I am hoping someone can help me. I created a form in dreamweaver, about 20 different fields, including text and radio button options. I used the post method. I know the only way to get this sent to my email when the person hits submit is through PHP, which I know nothing about. I wrote up something and previewed it in the browser when i push sumbit it goes to my thank you page so to me it seems to work but as soon as I upload the files to the server and push submit nothing happens. Can some please help me in what I have to write in the php file and if I need to write anything in the html file? I've been looking through so many sites but can't seem to get anything to work. Thank you and any help is greatly appreciated!! I included the php code I have below. Thanks again

<?php
$msg="email sent from site\n";
$msg.="fname: $_POST[firstname]\n";
$msg.="lname: $_POST[lastname]\n";
$msg.="dob: $_POST[dob]\n";
$msg.="address: $_POST[address]\n";
$msg.="city: $_POST[city]\n";
$msg.="state: $_POST[state]\n";
$msg.="zip: $_POST[zip]\n";
$msg.="phone: $_POST[phone]\n";
$msg.="email2: $_POST[email2]\n";
$msg.="gender: $_POST[gender]\n";
$msg.="service: $_POST[service]\n";
$msg.="active-duty: $_POST[active_duty]\n";
$msg.="wartime_service: $_POST[wartime_service]\n";
$msg.="service_disability: $_POST[service_disability]\n";
$msg.="percent_injury: $_POST[percent_injury]\n";
$msg.="injury_description: $_POST[injury_description]\n";
$msg.="mi_assistance: $_POST[mi_assistance]\n";
$msg.="assistance_description: $_POST[assistance_description]\n";
$msg.="medals: $_POST[medals]\n";
$msg.="medals_list: $_POST[medals_list]\n";



$to ="email@yahoo.com";
$subject="HFODT Application";
$mailheaders="From HFODT Website\n";
mail($to, $subject, $msg, $mailheaders);

header("location: thank_you.html");
?>
higgs2585 is offline   Reply With Quote
Old 02-26-2011, 12:37 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,171
Default

does the server have php on it?
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 02-26-2011, 07:22 AM   #3
higgs2585
 
Join Date: Feb 2011
Posts: 4
Default

Yes the server has php
higgs2585 is offline   Reply With Quote
Old 02-28-2011, 01:21 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,171
Default

try

$msg="email sent from site". "\n\n";
$msg.="fname:". $_POST['firstname']. "\n\n";
$msg.="lname:". $_POST['lastname']. "\n\n";


etc
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 03-01-2011, 10:26 PM   #5
higgs2585
 
Join Date: Feb 2011
Posts: 4
Default

That code worked. But I still do not get the email with all the information entered. Am I missing something for that? Do I need another php function?
Thanks again for all your help
higgs2585 is offline   Reply With Quote
Old 03-02-2011, 12:48 AM   #6
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,171
Default

post the code you have now
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 03-02-2011, 01:39 AM   #7
higgs2585
 
Join Date: Feb 2011
Posts: 4
Default

<?php
if(isset($_POST['submit'])) {

$msg="email sent from site". "\n\n";
$msg.="fname:". $_POST['firstname']. "\n\n";
$msg.="lname:". $_POST['lastname']. "\n\n";
$msg.="dob:". $_POST['dob']. "\n\n";
$msg.="address:". $_POST['address']. "\n\n";
$msg.="city:". $_POST['city']. "\n\n";
$msg.="state:". $_POST['state']. "\n\n";
$msg.="zip:". $_POST['zip']. "\n\n";
$msg.="phone:". $_POST['phone']. "\n\n";
$msg.="email2:". $_POST['email2']. "\n\n";
$msg.="gender:". $_POST['gender']. "\n\n";
$msg.="service:". $_POST['service']. "\n\n";
$msg.="active-duty:". $_POST['active_duty']. "\n\n";
$msg.="wartime_service:". $_POST['wartime_service']. "\n\n";
$msg.="service_disability:". $_POST['service_disability']. "\n\n";
$msg.="percent_injury:". $_POST['percent_injury']. "\n\n";
$msg.="injury_description:". $_POST['injury_description']. "\n\n";
$msg.="mi_assistance:". $_POST['mi_assistance']. "\n\n";
$msg.="assistance_description:". $_POST['assistance_description']. "\n\n";
$msg.="medals:". $_POST['medals']. "\n\n";
$msg.="medals_list:". $_POST['medals_list']. "\n\n";




$to ="email@yahoo.com";
$subject="HFODT Application";
$mailheaders="From HFODT Website\n";
mail($to, $subject, $msg, $mailheaders);

header("location: thank_you.html");
}
?>
higgs2585 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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

Forum Jump


All times are GMT. The time now is 07:58 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com