Hi I am new to flash and php coding,here is my code I am not able to find error in the flash & php code and its not showing any error in browser ,not updating to database.IF some one can help me out ,Its greatly appreciated.
on(release)
{
var myVars:LoadVars = new LoadVars();
var result_lv:LoadVars = new LoadVars();
myVars.firstname = this._parent.txtFirstname.text;
myVars.lastname = this._parent.txtLastName.text;
myVars.company = this._parent.txtCompany.text;
myVars.email = this._parent.txtEmail.text;
myVars.city = this._parent.txtCity.text;
myVars.country = this._parent.txtCountry.text;
//myVars.load("SetDetails.php", myVars, "POST");
//getURL("SetDetails1.php",myVars, "POST");
//myVars.send("SetDetails.php",myVars,"POST");
myVars.sendAndLoad("SetDetails1.php", result_lv, "POST");
result_lv.onLoad = function(success)
{
if (success)
{
if(userIn.qstatus=="passed")
{
msgbox.text = "Successfully Submitted";
}
}
else
{
msgbox.text = "nope";
}
}
txtFirstname.text = "";
txtLastName.text = "";
txtCompany.text = "";
txtEmail.text = "";
txtCity.text = "";
txtCountry.text = "";
//loadVariablesNum("SetDetails.asp",0,"post");
}
//My PHP Code
PHP Code:
<?php
import_request_variables("myVars");
//Connect To Database
$hostname='localhost';
$username='xxxxxxxxx';
$password='xxxxxxxxx';
$conn = mysql_connect($hostname, $username, $password) OR DIE('Unable to connect to database! Please try again later.'.mysql_error());
mysql_select_db('thresholdassetsdatabase') or die('could not select database'.mysql_error());
//stores the URLvariables into variables that php can use
$FirstName = $_POST['firstname'];
$LastName = $_POST['lastname'];
$Company= $_POST['company'];
$Email = $_POST['email'];
$City = $_POST['city'];
$Country = $_POST['country'];
echo "$FirstName";
echo "$LastName";
echo "$Company";
echo "$Email";
echo "$City";
echo "$Country";
//this is the command used to write the record into the MySQL database
$query="INSERT into newsletter_emails_imade ('FirstName', 'LastName','Company','Email','City','Country') VALUES ("%$FirstName%", "%$LastName%", "%$Company%", "%$Email%", "%$City%", "%$Country%")";
//executes the command
mysql_query($query) or die("Data not written.");
echo("The data has been written to the table!");
if(qstatus){
echo "&qstatus=passed";
}else{
echo "&qstatus=falied";
}
mysql_close($conn);
?>