iconicCreator Posted January 27, 2009 Share Posted January 27, 2009 I created this PHP script that process forms with a lot of help from people in here and other forum. Everything appeared to be working well so far. What I'm trying to do is use the senders first and last name in the form "from:" instead of their e-mail address. Example: From: Wayne Newton, instead of From: [email protected] This is the code/script for the form. I'm a total PHP novice and so please bare with my ignorance. <?php //FORM INPUT COLLECTION $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $email = $_POST['email']; $soupPreference = $_POST['soupPreference']; $howMany = $_POST['howMany']; $changes = $_POST['changes']; $messageComments = $_POST['messageComments']; //FORM PROCESSOR $to = '[email protected]'; $subject = 'Canned soup evaluation report'; $msg = "First Name: $firstName\n\n" . "Last Name: $lastName\n\n" . "E-Mail: $email\n\n" . "Do you like canned soup? $soupPreference\n\n" . "How many canned soup do you eat in a day? $howMany\n\n" . "What changes or suggestions would you recommend: $changes\n\n" . "Comments: $messageComments"; mail($to, $subject, $msg, 'from:' . $email); ?> <?php $myVar = "Thanks <span class=\"sendersName\">$firstName</span> for evaluating our product, we will contact you within 24 hours."; ?> <div class="confirmation"><?php echo $myVar; ?></div> Thank everyone - IC Link to comment https://forums.phpfreaks.com/topic/142592-solved-please-help-question-about-processing-php-forms/ Share on other sites More sharing options...
void Posted January 27, 2009 Share Posted January 27, 2009 http://www.php.net/manual/en/function.mail.php take a look at $headers variable mate. Link to comment https://forums.phpfreaks.com/topic/142592-solved-please-help-question-about-processing-php-forms/#findComment-747363 Share on other sites More sharing options...
iconicCreator Posted January 27, 2009 Author Share Posted January 27, 2009 http://www.php.net/manual/en/function.mail.php take a look at $headers variable mate. Well, the names would be taken or generated from the name variables. what ever name that is type in the form name field. This doesn't work with the header. IC Link to comment https://forums.phpfreaks.com/topic/142592-solved-please-help-question-about-processing-php-forms/#findComment-747365 Share on other sites More sharing options...
haku Posted January 27, 2009 Share Posted January 27, 2009 Yes it does, you just have to assign the values to ['additional_parameters']. There are a million threads on this site with that info, as well as a million sites on google. A couple searches will help you out. Link to comment https://forums.phpfreaks.com/topic/142592-solved-please-help-question-about-processing-php-forms/#findComment-747376 Share on other sites More sharing options...
uniflare Posted January 27, 2009 Share Posted January 27, 2009 read the page they gave you. specifically at Example #4: Sending HTML email Link to comment https://forums.phpfreaks.com/topic/142592-solved-please-help-question-about-processing-php-forms/#findComment-747409 Share on other sites More sharing options...
iconicCreator Posted January 27, 2009 Author Share Posted January 27, 2009 Yes it does, you just have to assign the values to ['additional_parameters']. There are a million threads on this site with that info, as well as a million sites on google. A couple searches will help you out. Being absolutely new to PHP and trying to learn it by doing practical projects - I don't want to copy and paste from google search results because I have no way of knowing if what I'm copying and pasting is authentic, up to date or the best way to write a script. I rather hold someone in here responsible for my screw ups! ;D I read the link but still can't understand how the headers or the additional parameters will get the senders name using the first and last name variables. When I received an email, the From: area contains the senders e-mail, I already have the senders e-mail being gathered from the e-mail body. I would rather the From: area in the received e-mail contained the user name, this way I can tell who sent the mail since it's for a personal website. IC Link to comment https://forums.phpfreaks.com/topic/142592-solved-please-help-question-about-processing-php-forms/#findComment-747610 Share on other sites More sharing options...
haku Posted January 27, 2009 Share Posted January 27, 2009 Fair enough - there is a lot of garbage code out there. But the other side of that is that you are much more likely to get help by putting something together, showing us, and asking us about it. Now as far as your problem, read the post above yours. Link to comment https://forums.phpfreaks.com/topic/142592-solved-please-help-question-about-processing-php-forms/#findComment-747626 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.