Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form mailer with db

Status
Not open for further replies.

mwebbo1

Technical User
Jul 11, 2002
71
US
I have a form that sends the information into a db and also sends an email...a friend of mine did this and it worked when an actual@name.com address is in there. bUt not like this $email. Any ideas?
============
$the_name= $HTTP_POST_VARS ["the_name"];
$email= $HTTP_POST_VARS ["email"];
$sex= $HTTP_POST_VARS ["sex"];
$age= $HTTP_POST_VARS ["age"];
$job_level= $HTTP_POST_VARS ["job_level"];
$education= $HTTP_POST_VARS ["education"];
$divisions= $HTTP_POST_VARS ["divisions"];
$ethnicity= $HTTP_POST_VARS ["ethnicity"];

mysql_select_db("rethought");
$query="insert into tara_survey(name,email,age,sex,job_level,education,divisions,ethnicity) values ('$the_name','$email',$age,$sex,$job_level,$education,$divisions,$ethnicity)";
//echo $query;
mysql_query($query, $db);

$query = "select code from codes where id =". mysql_insert_id();
$result = mysql_query($query,$db);
$row = mysql_fetch_object($result);

mysql_free_result($result);


$body="Thank you, the links to your surveys are below.
============
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: me@earthlink.net\r\n";

//echo $body;


//$result = mail("me@here.com", "Survey Link Request",$body, $headers);

$result = mail( $email, "Survey Link Request",$body, $headers);

//echo "The mail " .$result;
=========
 
Have you verified that $email actually has a value in it?

Your script attempts to place a value in $email from $HTTP_POST_VARS['email'], but that array may not necesarily exist. The default for PHP 5 is that the so-called "long" $HTTP_*_VARS arrays are not instantiated, as they have been deprecated in favor of the "short" superglobal arrays.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
well. I am not a php guy, I do graphic design and the guy that did this is not reachable, is there some code that i could throw in there, that will send to the email address added to the form. I know this may sound stupid, just dont know!
 
well, here is what I did in the meantime,
====
$result = mail("$email, my@address.com", "Survey Link Request",$body, $headers);
=====
and it worked, it sends to me, and the registrant, that is what I wanted it to do. I do not know enough about what you would need me to do to test, I will wait for my guy to return from vacation as long as this is working, thanks for the help and you time, much appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top