rogueonline Posted March 29, 2009 Share Posted March 29, 2009 Hi, I'm a novice in php, i've just begun coding in php i was doing this form script for a friend and i've really managed just the basics i need some help to go further with this so please be kind. so this i what my script is like for getting an email back <?php //set up some basic configuration $email_to = 'myemail@gmail.com'; // i want to put two emails here can i just put it by using a , to separate the 2? or will i have to make 2 variables $subject = 'Website Feedback'; // recieve variables from feedback // i want to make first name, last name, company, phone and email compulsory fields and display an error message if they are not filled $FirstName = $_POST['FirstName']; $LastName = $_POST['LastName']; $Company = $_POST['Company']; $Designation = $_POST['Designation']; $Address1 = $_POST['Address1']; $Address2 = $_POST['Address2']; $City = $_POST['City']; $Country = $_POST['Country']; $Phone = $_POST['Phone']; $Email = $_POST['Email']; $Lining = $_POST['Lining']; $Products = $_POST['Products']; $Comments = $_POST['Comments']; $message = "First Name: ". $FirstName . "\n"; $message .= "Last Name: ". $LastName . "\n"; $message .= "Company: ". $Company . "\n"; $message .= "Designation: ". $Designation . "\n"; $message .= "Address1: ". $Address1 . "\n"; $message .= "Address2: ". $Address2 . "\n"; $message .= "City: ". $City . "\n"; $message .= "Country: ". $Country . "\n"; $message .= "Phone No: ". $Phone . "\n"; $message .= "Lining Required: ". $Lining . "\n"; $message .= "Products interested in : ". $Email . "\n"; $message .= "Comments: ". $Comments . "\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Sent</title> </head> <body> <?php /*echo $FirstName."<br/>".$LastName."<br/>".$Company."<br/>".$Designation."<br/>".$Address1."<br/>".$Address2."<br/>".$City."<br/>".$Country."<br/>".$Phone."<br/>".$Email."<br/>".$Lining."<br/>".$Products."<br/>".$Comments."<br/>";*/ // and here instead of an echo i want it to go to another html page with a thank you message which i have already made if (mail($email_to , $subject , $message )) { echo "Your details have been submitted" ; }else{ echo "Please resubmit your form" ; } ?> </body> </html> so here's what i need help about summed up again 1) Currently i am emailing it to just one address i want to send it to multiple 2) i want to make first name, last name, company, phone and email compulsory fields and display an error message if they are not filled 3) and instead of an echo at the press of the submit button i want it to go to another html page with a thank you message which i have already made 4)i also have a reset button which does a submit if i click it is there some code to be put to that too? i have built the webform using dreamweaver, also if someone could also show me how to integrate an antispam code in this 5) Also i would like to clear the information from the form once the information is sent, even when i refresh it the values filled in stay so there might be something to clear the session or something if you do need the html page that im attaching the script to i will be glad to put it up here Please i need to understand how to do this and would appreciate any help regarding this.. thank you very much Quote Link to comment Share on other sites More sharing options...
phpretard Posted March 29, 2009 Share Posted March 29, 2009 Where are the additional emails coming from? Quote Link to comment Share on other sites More sharing options...
rogueonline Posted March 29, 2009 Author Share Posted March 29, 2009 oh the email is where i am sending the contact form info to. At the moment i know only how to send to one email i want to send the information to more than one email Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.