...

View Full Version : problems with email



fogofogo
05-02-2006, 05:02 PM
Hello all,

I have some code below that creates an email from a web form :


<?php
// create the email message

$msg .= "Please create this account and credit it with $10 \n\n\n";

$msg .= "ACCOUNT DETAILS \n\n";

if ($nickname != "") {
$msg .= "Nick Name : $nickname\n";
}
if ($username != "") {
$msg .= "User Name : $username\n";
}
if ($password != "") {
$msg .= "Password : $password\n\n";
}
$msg .= "Personal DETAILS \n\n";

if ($from != "") {
$msg .= "First Name : $from\n";
}
if ($middlename != "") {
$msg .= "Middle Name : $middlename\n";
}
if ($lastname != "") {
$msg .= "Last Name : $lastname\n";
}
if ($dateofbirth != "") {
$msg .= "Date of Birth : $dateofbirth\n";
}
$msg .= "Address : $address\n";

if ($town != "") {
$msg .= "Town : $town\n";
}
if ($postcode != "") {
$msg .= "Postcode : $postcode\n";
}
if ($county != "") {
$msg .= "County : $county\n";
}
if ($country != "") {
$msg .= "Country : $country\n";
}
if ($telephone != "") {
$msg .= "Telephone : $telephone\n";
}
if ($email != "") {
$msg .= "Email : $email\n";
}

if ($bigslickprivate != "") {
$msg .= "Join the Big Slick Private Members club? : $bigslickprivate\n";
}
if ($bigslickplayers != "") {
$msg .= "Join the Big Slick Players Club? : $bigslickplayers\n";
}
if ($bigslickpreffered != "") {
$msg .= "Obtain membership to Big Slick's preferred members club? : $bigslickpreffered\n\n";
}
$msg .= "Sent : $today\n";

$mailheaders = "Poker account registration ( $username ) \n";

$mailheaders = "From: $email";


mail($to, $subject, $msg, $mailheaders);


I am trying to have the users email address (the person who has just filled out the form) appear in the "from" field, but the webserver seems to fill in its own address.

here is how I have the from address set up :


$mailheaders = "From: $email";

the $email variable is populated from a form field. Any Ideas how to do this?

Thanks

goughy000
05-02-2006, 07:53 PM
are you setting the $email var correctly?



//If its from a POST method form
$email = $_POST['email'];

//if its in the url (GET method)
$email = $_POST['email'];



EDIT:
also... whats all this about:


$mailheaders = "Poker account registration ( $username ) \n";


didnt you mean


$subject = "Poker account registration ( $username ) \n";

???

or to be more syntax correct...


$subject = "Poker account registration ( " . $username . " ) \n";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum