Search Webmaster Help and Solution

Inserting Data into Mysql then send email?

Hello I have yet another delima i need to figure out why the email is sending but the values are not showing up in the data base.

this is my table structure

CREATE TABLE IF NOT EXISTS `fname` (
`fname` text NOT NULL,
`lname` text NOT NULL,
`email` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and this is the script

<?php



// Receiving variables
$loanamt = addslashes($_GET[loanamt]);
$fname = addslashes($_GET[fname]);
$lname = addslashes($_GET[lname]);
$email = addslashes($_GET[email]);
$province = addslashes($_GET[province]);
$postal = addslashes($_GET[postal]);


$con = mysql_connect("localhost","test","");
if (!$con)
{
die(Could not connect: . mysql_error());
}

mysql_select_db("zanzu_test", $con);

$sql="INSERT INTO fname (fname,lname,email)
VALUES
($_POST[fname],$_POST[lname],$_POST[email])";

if (!mysql_query($sql,$con))
{
die(Error: . mysql_error());
}

mysql_close($con);

$header = "From: $email "
. "Reply-To: $email ";
$subject = "CashLoans.ca | Payday Loan Request";
$email_to = " This e-mail address is being protected from spambots. You need JavaScript enabled to view it ";
$message = "loanamt: $loanamt "
. "fname: $fname "
. "lname: $lname "
. "email: $email "
. "province: $province "
. "postal: $postal ";
mail($email_to, $subject ,$message ,$header ) ;

header("Location: http://www.autocarloans.ca/apply-online.html");



?> Hello I have yet another delima i need to figure out why the email is sending but the values are not showing up in the data base.

this is my table structure

CREATE TABLE IF NOT EXISTS `fname` (
`fname` text NOT NULL,
`lname` text NOT NULL,
`email` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and this is the script

<?php



// Receiving variables
$loanamt = addslashes($_GET[loanamt]);
$fname = addslashes($_GET[fname]);
$lname = addslashes($_GET[lname]);
$email = addslashes($_GET[email]);
$province = addslashes($_GET[province]);
$postal = addslashes($_GET[postal]);


$con = mysql_connect("localhost","test","");
if (!$con)
{
die(Could not connect: . mysql_error());
}

mysql_select_db("zanzu_test", $con);

$sql="INSERT INTO fname (fname,lname,email)
VALUES
($_POST[fname],$_POST[lname],$_POST[email])";

if (!mysql_query($sql,$con))
{
die(Error: . mysql_error());
}

mysql_close($con);

$header = "From: $email "
. "Reply-To: $email ";
$subject = "CashLoans.ca | Payday Loan Request";
$email_to = " This e-mail address is being protected from spambots. You need JavaScript enabled to view it ";
$message = "loanamt: $loanamt "
. "fname: $fname "
. "lname: $lname "
. "email: $email "
. "province: $province "
. "postal: $postal ";
mail($email_to, $subject ,$message ,$header ) ;

header("Location: http://www.autocarloans.ca/apply-online.html");



?>

View Complete Thread with Replies

Related Items

Query failed: connection to localhost:3354 failed (errno=111, msg=Connection refused).