Jump to content

New to PHP....processor.php file to process online form


junebug8

Recommended Posts

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");

 

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Here's the error I was receiving, and have since fixed, I think!  ;D 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.

Link to comment
Share on other sites

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";
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.