Jump to content

PHP Form Processing


dan182skater

Recommended Posts

Hello everyone! Quick question:

 

I have a form that I made with phpFormGenerator and the processor.php file makes the form have this in the "From" field when it is sent to my email:

 

Nobody [[email protected]]

 

I'm not that good with PHP but can see from below that the email above is a default server email address for the hosting account I have and it is being retrieved from the PHP line below:

 

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

 

How can I make the "From" field simple be an email address that I specify?

 

THANK YOU!!!!

Link to comment
https://forums.phpfreaks.com/topic/60697-php-form-processing/
Share on other sites

processor.php

 

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

mail("[email protected]","MCWL New Member - Form submission","Form data:

Name: " . $_POST['field_1'] . " 
Telephone: " . $_POST['field_2'] . " 
Email: " . $_POST['field_3'] . " 
Business Address: " . $_POST['field_4'] . " 
Address Line 2: " . $_POST['field_5'] . " 
City: " . $_POST['field_6'] . " 
State: " . $_POST['field_7'] . "
Zip Code: " . $_POST['field_8'] . " 
Website: " . $_POST['field_9'] . " 
Areas of Practice: " . $_POST['field_10'] . " 






");

include("newmember_thankyou.html");

?>

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/60697-php-form-processing/#findComment-302067
Share on other sites

try this...

 


<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));


$to = '[email protected]';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
$subject = 'MCWL New Member - Form submission';
$message = "Form data:

Name: " . $_POST['field_1'] . " 
Telephone: " . $_POST['field_2'] . " 
Email: " . $_POST['field_3'] . " 
Business Address: " . $_POST['field_4'] . " 
Address Line 2: " . $_POST['field_5'] . " 
City: " . $_POST['field_6'] . " 
State: " . $_POST['field_7'] . "
Zip Code: " . $_POST['field_8'] . " 
Website: " . $_POST['field_9'] . " 
Areas of Practice: " . $_POST['field_10'];

mail($to, $subject, $message, $headers);

include("newmember_thankyou.html");

?>

Link to comment
https://forums.phpfreaks.com/topic/60697-php-form-processing/#findComment-302931
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.