adman32 Posted September 26, 2014 Share Posted September 26, 2014 I have a new website which is using a php form send script for email enquiries. The old website was using a php script which worked fine but the new site has a problem with the script. The builder of the site (who is currently on holidays and uncontactable) provided the form send script which sends a email to me notifying that someone has used the site to send an email but the email doesn't contain any information. I just get an email saying that an enquiry has been submitted through the site. No name, email or message. Also the script doesn't send the person after they hit submit to the thank you for contacting us page it just provides a plain text message on a blank page. I have a thank you page set up but not sure what code needs to be used to send it to that page. I am sure something like this is here somewhere but whilst I have a reasonably good knowledge of html I don't understand php at all and was wondering if someone could please help. The script for the form send I have been given is <script language="php"> $email = $HTTP_POST_VARS; $mailto = "info@globalfundraisinginitiative.com"; $mailsubj = "Enquiry From The GFI Website"; $mailhead = "From: info@globalfundraisinginitiative.com"; $headers = "To: info@globalfundraisinginitiative.com" . "\r\n" . "CC: info@globalfundraisinginitiative.com"; reset ($HTTP_POST_VARS); $mailbody = "The following enquiry has been submitted via the GFI Website:\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; } if (!eregi("\n",$HTTP_POST_VARS)) { mail($mailto, $mailsubj, $mailbody, $mailhead); } function checkforspam() { if ( preg_match( "/bcc:|Content-Type:/i", implode( $_POST ) ) ){ return 'Y'; } else { return 'N'; } } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Form Sent</title> </head> <body> <center> <h1>Sent and thanks.</h1> </center> </body> </html> <script language="php"> $email = $HTTP_POST_VARS; $mailto = "info@globalfundraisinginitiative.com"; $mailsubj = "Enquiry From The GFI Website"; $mailhead = "From: info@globalfundraisinginitiative.com"; $headers = "To: info@globalfundraisinginitiative.com" . "\r\n" . "CC: info@globalfundraisinginitiative.com"; reset ($HTTP_POST_VARS); $mailbody = "The following enquiry has been submitted via the GFI Website:\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; } if (!eregi("\n",$HTTP_POST_VARS)) { mail($mailto, $mailsubj, $mailbody, $mailhead); } function checkforspam() { if ( preg_match( "/bcc:|Content-Type:/i", implode( $_POST ) ) ){ return 'Y'; } else { return 'N'; } } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Form Sent</title> </head> <body> <center> <h1>Sent and thanks.</h1> </center> </body> </html> And the code on the page is <!-- Contact Form --> <section class="footer-one"> <form id="contacts-form" action="html_form_send.php" method="post"> <div> <div class="row half"> <div class="6u"> <input type="text" class="text" name="contact-name" id="contact-name" placeholder="Name" /> </div> <div class="6u"> <input type="text" class="text" name="contact-email" id="contact-email" placeholder="Email" /> </div> </div> <div class="row half"> <div class="12u"> <textarea name="contact-message" id="contact-message" placeholder="Message"></textarea> </div> </div> <div class="row"> <div class="12u"> <ul class="actions"> <li><input type="submit" class="button button-style1" value="Send" /></li> <li><input type="reset" class="button button-style2" value="Reset" /></li> </ul> </div> </div> </div> </form> </section> <!-- /Contact Form --> Quote Link to comment Share on other sites More sharing options...
abdul202 Posted September 26, 2014 Share Posted September 26, 2014 here is after modification, it's very basic the programmer must work on it or you can use another script that has more features and security it's just one file <script language="php"> if (!empty($_POST)) { $email = $_POST['contact-email']; $body = $_POST['contact-message'] ; $name = $_POST['contact-name']; $mailto = "info@globalfundraisinginitiative.com"; $mailsubj = "Enquiry From The GFI Website"; $mailhead = "From: info@globalfundraisinginitiative.com"; $headers = "To: info@globalfundraisinginitiative.com" . "\r\n" . "CC: info@globalfundraisinginitiative.com"; $mailbody = "The following enquiry has been submitted via the GFI Website:\n"; $mailbody .= $body ."\n" ; // the message body $mailbody .= "his email is ".$email ."\n" ; // the message body $mailbody .= "his name is ".$name ."\n" ; // the message body mail($mailto, $mailsubj, $mailbody, $mailhead); echo '<center><h1>Sent and thanks.</h1></center>'; } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Form Sent</title> </head> <body> <!-- Contact Form --> <section class="footer-one"> <form id="contacts-form" action="" method="post"> <div> <div class="row half"> <div class="6u"> <input type="text" class="text" name="contact-name" id="contact-name" placeholder="Name" /> </div> <div class="6u"> <input type="text" class="text" name="contact-email" id="contact-email" placeholder="Email" /> </div> </div> <div class="row half"> <div class="12u"> <textarea name="contact-message" id="contact-message" placeholder="Message"></textarea> </div> </div> <div class="row"> <div class="12u"> <ul class="actions"> <li><input type="submit" class="button button-style1" value="Send" /></li> <li><input type="reset" class="button button-style2" value="Reset" /></li> </ul> </div> </div> </div> </form> </section> <!-- /Contact Form --> </body> </html> Quote Link to comment Share on other sites More sharing options...
adman32 Posted September 26, 2014 Author Share Posted September 26, 2014 Thanks so much abdul202. I really appreciate you help. it is passing through the details now. Any suggestions on how to get the code to go to my thank you for contacting us page? Quote Link to comment Share on other sites More sharing options...
abdul202 Posted September 26, 2014 Share Posted September 26, 2014 if you want the form in a page and the php code whch process and showing the thank you message on another page make 2 separate page the first <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Form Sent</title> </head> <body> <!-- Contact Form --> <section class="footer-one"> <form id="contacts-form" action="html_form_send.php" method="post"> <div> <div class="row half"> <div class="6u"> <input type="text" class="text" name="contact-name" id="contact-name" placeholder="Name" /> </div> <div class="6u"> <input type="text" class="text" name="contact-email" id="contact-email" placeholder="Email" /> </div> </div> <div class="row half"> <div class="12u"> <textarea name="contact-message" id="contact-message" placeholder="Message"></textarea> </div> </div> <div class="row"> <div class="12u"> <ul class="actions"> <li><input type="submit" class="button button-style1" value="Send" /></li> <li><input type="reset" class="button button-style2" value="Reset" /></li> </ul> </div> </div> </div> </form> </section> <!-- /Contact Form --> </body> </html> and save it as form.html for example and create another page <script language="php"> if (!empty($_POST)) { $email = $_POST['contact-email']; $body = $_POST['contact-message'] ; $name = $_POST['contact-name']; $mailto = "info@globalfundraisinginitiative.com"; $mailsubj = "Enquiry From The GFI Website"; $mailhead = "From: info@globalfundraisinginitiative.com"; $headers = "To: info@globalfundraisinginitiative.com" . "\r\n" . "CC: info@globalfundraisinginitiative.com"; $mailbody = "The following enquiry has been submitted via the GFI Website:\n"; $mailbody .= $body ."\n" ; // the message body $mailbody .= "his email is ".$email ."\n" ; // the message body $mailbody .= "his name is ".$name ."\n" ; // the message body mail($mailto, $mailsubj, $mailbody, $mailhead); echo '<center><h1>Sent and thanks.</h1></center>'; } </script> and save it as html_form_send.php 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.