junebug8 Posted June 27, 2007 Share Posted June 27, 2007 I have a online html form that uses a processor.php file to process the information and send it via email. Below is the code from the processor.php file. Can somebody tell me if the code is correct? <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // Checkbox handling $field_5_opts = $_POST['field_5'][0].",". $_POST['field_5'][1].",". $_POST['field_5'][2].",". $_POST['field_5'][3]; mail("j.jensen@weirsp.com","phpFormGenerator - Form submission","Form data: How do you rate the helpfulness of Weir Specialty Pumps' employees?: " . $_POST['field_1'] . " How do we perform when it comes to fulfulling quote requests?: " . $_POST['field_2'] . " Please rate the quality of our products as you receive them?: " . $_POST['field_3'] . " Do the responses and actions of your Regional Sales Manager match your expectations?: " . $_POST['field_4'] . " In what way could our sales support most improve? (Check all that apply.): $field_5_opts : " . $_POST['field_6'] . " Name:: " . $_POST['field_7'] . " Company:: " . $_POST['field_8'] . " E-mail:: " . $_POST['field_9'] . " Comments:: " . $_POST['field_10'] . " powered by phpFormGenerator. "); include("confirm.html"); ?> Quote Link to comment Share on other sites More sharing options...
trq Posted June 27, 2007 Share Posted June 27, 2007 Can somebody tell me if the code is correct? Does it work? Quote Link to comment Share on other sites More sharing options...
junebug8 Posted June 27, 2007 Author Share Posted June 27, 2007 It seems to work, but I never receive a email with the processed information. I was getting a function.mail error but have since resolved that. I believe it is sending the email, but I'm not sure if I have the recipient field correctly formatted. Quote Link to comment Share on other sites More sharing options...
trq Posted June 27, 2007 Share Posted June 27, 2007 Have you checked your trash or spam folders? Quote Link to comment Share on other sites More sharing options...
junebug8 Posted June 27, 2007 Author Share Posted June 27, 2007 Yes. Quote Link to comment Share on other sites More sharing options...
trq Posted June 27, 2007 Share Posted June 27, 2007 Well, theres nothing particuarly wrong with your code. What was the error you where getting and how did you fix it? Quote Link to comment Share on other sites More sharing options...
junebug8 Posted June 27, 2007 Author Share Posted June 27, 2007 Here's the error I was receiving, and have since fixed, I think! I'm not getting this error any more. Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in D:\Wild\www\envirotechslc.com\survey\tempFiles\form1658\processor.php on line 26" I fixed it by making modifications to my mail function section of the php.ini file. Quote Link to comment Share on other sites More sharing options...
trq Posted June 27, 2007 Share Posted June 27, 2007 Ok... well the only thing I can sugest would be to send some additional headers aswell. Some mail servers don't like recieving your mail otherwise. <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // Checkbox handling $field_5_opts = $_POST['field_5'][0].",". $_POST['field_5'][1].",". $_POST['field_5'][2].",". $_POST['field_5'][3]; $to = "j.jensen@weirsp.com"; $subject = "phpFormGenerator - Form submission"; $message = "Form data: How do you rate the helpfulness of Weir Specialty Pumps' employees?: " . $_POST['field_1'] . " How do we perform when it comes to fulfulling quote requests?: " . $_POST['field_2'] . " Please rate the quality of our products as you receive them?: " . $_POST['field_3'] . " Do the responses and actions of your Regional Sales Manager match your expectations?: " . $_POST['field_4'] . " In what way could our sales support most improve? (Check all that apply.): $field_5_opts : " . $_POST['field_6'] . " Name:: " . $_POST['field_7'] . " Company:: " . $_POST['field_8'] . " E-mail:: " . $_POST['field_9'] . " Comments:: " . $_POST['field_10'] . " powered by phpFormGenerator. "; $headers = 'From: webmaster@weirsp.com' . "\r\n" . 'Reply-To: webmaster@weirsp.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $message, $headers)) { include "confirm.html"; } else { echo "mail failed to send"; } ?> Quote Link to comment Share on other sites More sharing options...
junebug8 Posted June 27, 2007 Author Share Posted June 27, 2007 I changed my code to what you had posted now I get a "mail failed to send" error when it goes to use the processor.php file?? 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.