Re: Newbie question about sending email
| From: | Pete Holsberg | Date: | Wed, 16 Apr 2008 21:14:27 +0000 |
| Subject: | Re: Newbie question about sending email | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273125@lists.php.net to get a copy of this message | ||
Daniel Brown has written on 4/16/2008 4:56 PM:
On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg <pjh42@pobox.com> wrote:Why do I need both from_addr and field_4 (Email Address)? Could I just use $from = $_POST['field_4']? Thanks.The entire processor.php file is: <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); mail("4sam-nj-subscribe@yahoogroups.com,pjh42@pobox.com","SUBSCRIBE","Form data: Name: " . $_POST['field_1'] . " Street Address: " . $_POST['field_2'] . " Phone Number: " . $_POST['field_3'] . " Email Address: " . $_POST['field_4'] . " powered by phpFormGenerator. "); include("confirm.html"); ?>Note the mail() parameters. There's no header information there.In your HTML form, add the following field (dress up the HTML asneeded to fit with your form): <input type="text" name="from_addr">Then, change the email processing code to the following:<?php $where_form_is = "http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/"; $to = "4sam-nj-subscribe@yahoogroups.com,pjh42@pobox.com"; $subject = "SUBSCRIBE"; $from = $_POST['from_addr']; $body = "Form data: Name: ".$_POST['field_1']." Email: ".$_POST['from_addr']." Street Address: ".$_POST['field_2']." Phone Number: ".$_POST['field_3']." Email Address: ".$_POST['field_4']."