Hi, iam not able to send data to SQL database…
SWF
A movieClip with Instance name “form”. Inside form MC there are 3 text Fields
They have Variables as:
NAME= “yourname”
EMAIL=“youremail”
MESSAGES= “yourcomments”
Outside mc on main stage a button SEND with actions…
//start
on (release) {
form.loadVariables("receive.php", "POST");
trace(form.yourname);
trace(form.youremail);
trace(form.yourcomments);
}
//end
when traced i get all the inputs typed in are displayed correctly
iam trying to send these to my SQL database through PHP
Can someone please help me with action here
My receive.php has
<?
//Subscribers
// initialize my SQL database
$host="localhost";
$user="root";
$pass="";
$DBname="test";
$table="received";
//connect to mySQL
$DBConn=mysql_connect($host, $user, $pass) or die("Error in Application:" .mysql_error());
//select mySL DB
mysql_select_db($DBname, $DBConn) or die("Error in Application:" .mysql_error());
//Receive Vars from Flash
$getName = ereg_replace("&", "%26", $_POST['yourname']);
$getEmail = ereg_replace("&", "%26", $_POST['youremail']);
$getComments = ereg_replace("&", "%26", $_POST['yourcomments']);
$submitted_on = date ("Y-m-d H:i:s",time()); // server date n time yy-mm-dd format
$sender = $REMOTE_ADDR; // remote Server
$submit = $_POST['submit'];
//check if submitted from flash
if($submit=='Yes'){
//insert data into SQL table
$sql='INSERT INTO ' . $table .
' (`ID`,
`name`,
`email`,
`comments`,
`time`,
`sender`
)
VALUES
(\'\','
.'\'' . $getName . '\','
.'\'' . $getEmail_on . '\','
.'\'' . $getComments . '\','
.'\'' . $submitted_on . '\','
.'\'' . $sender . '\'
)';
$insert= mysql_query($sql, $DBConn) or die ("Error in Application: " . mysql_error());
// Script End
print "&err=Thank you for signing my Email.&done=yes&";
return;
}
print "&_root.write.err=Error!&";
//break;
mysql_close();
?>
My SQL database
CREATE TABLE received (
ID int(5) NOT NULL auto_increment,
name text NOT NULL,
email text NOT NULL,
comments text NOT NULL,
time datetime NOT NULL default '0000-00-00 00:00:00',
sender text NOT NULL,
PRIMARY KEY (ID)
) TYPE=MyISAM;
cannot send the data to the database. Please help. Please download the file
www.xtreme.dreamhosters.com/receive/receive.zip
if you can rectify then please help