Forum Moderators: coopster
<?php
$msg ="First Name:\t$first_name\n";
$msg .="Last Name:\t$last_name\n";
$msg .="Address 1:\t$address_Line_1\n";
$msg .="Address 2:\t$address_Line_2\n";
$msg .="City:\t$city\n";
$msg .="State:\t$state\n";
$msg .="Zip Code:\t$zip\n";
$msg .="Telephone:\t$telephone\n";
$msg .="E-Mail:\t$email\n";
$msg .="Web Site URL:\t$website_url\n";
$msg .="Comments:\t$comments\n\n";
$mailheaders ="From: - Contact Information\n";
$mailheaders = "Reply-To:$email\n\n";
mail("name@domain.com","Feedback Form",$msg,$mailheaders);
?>
Thanks in advance!
Christina
[edited by: jatar_k at 5:22 pm (utc) on May 30, 2003]
[edit reason] removed specific email [/edit]
Php.net is a good place to learn about any PHP function. Here is the mail() [us2.php.net] page.
I think if you try something like this, it should work:
<?php
$msg ="First Name:\t$first_name\n";
$msg .="Last Name:\t$last_name\n";
$msg .="Address 1:\t$address_Line_1\n";
$msg .="Address 2:\t$address_Line_2\n";
$msg .="City:\t$city\n";
$msg .="State:\t$state\n";
$msg .="Zip Code:\t$zip\n";
$msg .="Telephone:\t$telephone\n";
$msg .="E-Mail:\t$email\n";
$msg .="Web Site URL:\t$website_url\n";
$msg .="Comments:\t$comments\n\n";
mail("name@domain.com","Feedback Form",$msg,"From: $email\r\n" . "Reply-To: $email\r\n");
?>
I changed the From: value to $email and stuck them right into the mail() function.
ps: Welcome to Webmaster World!
[edited by: jatar_k at 5:23 pm (utc) on May 30, 2003]
[edit reason] removed specific email [/edit]
Add this after the mail() line:
print $msg;
If the variables are not printed on the page, you may need to acces your variables using this method:
$_POST['first_name']
$_POST['last_name']
...etc
Or, alternatively, you can extract them all at once like this:
extract($_POST);
If you put that line first in your script, you should be fine.
extract($_POST);
$msg ="First Name:\t$first_name\n";
$msg .="Last Name:\t$last_name\n";
$msg .="Address 1:\t$address_Line_1\n";
$msg .="Address 2:\t$address_Line_2\n";
$msg .="City:\t$city\n";
$msg .="State:\t$state\n";
$msg .="Zip Code:\t$zip\n";
$msg .="Telephone:\t$telephone\n";
$msg .="E-Mail:\t$email\n";
$msg .="Web Site URL:\t$website_url\n";
$msg .="Comments:\t$comments\n\n";
mail("name@domain.com","Feedback Form",$msg,"From: $email\r\n" . "Reply-To: $email\r\n");
print $msg;
?>
This is what happens when the form is submitted:
First Name: Last Name: Address 1: Address 2: City: State: Zip Code: Telephone: E-Mail: Web Site URL: Comments:
I have also tried;
$_POST['first_name'];
$_POST['last_name'];
$_POST['address_line_1'];
$_POST['address_line_2'];
$_POST['city'];
$_POST['state'];
$_POST['zip'];
$_POST['telephone'];
$_POST['email'];
$_POST['website_url'];
$_POST['comments'];
instead of the extract($_POST); with the same results...
Am I still missing something?
[edited by: jatar_k at 5:24 pm (utc) on May 30, 2003]
[edit reason] removed specific email [/edit]
Have you tried putting the info in one file instead of passing it to another? ie:
<?php
if($_REQUEST['submit']) {
$msg ="First Name:\t$first_name\n";
$msg .="Last Name:\t$last_name\n";
$msg .="Address 1:\t$address_Line_1\n";
$msg .="Address 2:\t$address_Line_2\n";
$msg .="City:\t$city\n";
$msg .="State:\t$state\n";
$msg .="Zip Code:\t$zip\n";
$msg .="Telephone:\t$telephone\n";
$msg .="E-Mail:\t$email\n";
$msg .="Web Site URL:\t$website_url\n";
$msg .="Comments:\t$comments\n\n";
mail("name@domain.com","Feedback Form",$msg,"From: $email\r\n" . "Reply-To: $email\r\n");echo "Mail Sent";
exit;}
?>
Your HTML form would go here. Unless its using echo statements, then it goes before the?>
Your form action would be:
<form method="post" ACTION="<? echo $PHP_SELF;?>">
and assuming your submit button has the attribute:
<input type="submit" name="submit" value="Submit">
:)
[edited by: dreamcatcher at 6:56 pm (utc) on May 30, 2003]
$msg ="First Name:\t$HTTP_POST_VARS['first_name']\n";
$msg .="Last Name:\t$HTTP_POST_VARS['last_name']\n";
$msg .="Address 1:\t$HTTP_POST_VARS['address_Line_1']\n";
...etc...
This works (kinda)
<?php
extract($_POST);
$msg = $_POST['first_name'];
$msg .= $_POST['last_name'];
$msg .= $_POST['address_line_1'];
$msg .= $_POST['address_line_2'];
$msg .= $_POST['city'];
$msg .= $_POST['state'];
$msg .= $_POST['zip'];
$msg .= $_POST['telephone'];
$msg .= $_POST['email'];
$msg .= $_POST['website_url'];
$msg .= $_POST['comments'];
mail("name@address.com","Feedback Form",$msg,"From: $email\r\n" . "Reply-To: $email\r\n");
print $msg;
?>
Just a little fomat issue - everything is on one line:
testfirsttestlast123 Main StreetWalt Disney
WorldGA12345508-941-124micky@mouse.orgwww.disney.comtesting 3:23
You could try something a bit different and much simpler.
$msg = ";
foreach($_POST as $key => $value) {
$msg .= $key . ":\t" . $value . "\n";
}
echo $msg;
another thought would be to try print_r($_POST) [ca.php.net]. That should print out the contents of the post array. If there is nothing in it then it isn't getting passed properly.
What version of php are you using?