I don’t get it to work !!! :red: (of course/as usual)
I have a Flash-app.
I send vars from it to PHP. (works)
PHP stores in MySQL DB. (works)
PHP sends back to Flash for user verification. (DON’T WORK!)
Can someone with a sulotion help me out on this problem.
PLEASE!!!
Tanks in advance
/Kalliban (super-junior on this thing…)
Action-script for Frame 1:
[AS]
stop();
/// declare LoadVars to send to PHP
abc = new LoadVars();
/// declare LoadVars to recieve from PHP
recieved = new LoadVars();
/// sendAndLoad-function
function dataSAL() {
abc.sendAndLoad(“save.php”, recieved, “POST”);
abc.onLoad = dataRec(true);
}
/// data recieved=true function
function dataRec(success) {
if (success) {
nextFrame();
} else {
trace(“Failed!”);
}
}
[/AS]
AS for textinput “textXYZ”
[AS]
on (change) {
_root.abc.xyz = this.text;
}
[/AS]
AS for button
[AS]
on (click) {
/// Load the sendAndLoad-function
_root.dataSAL();
}
[/AS]
AS for Frame 2
[AS]
stop();
/// displaying the text recieved from PHP in the textarea
txtRecieved.text = recieved.xyz;
[/AS]
PHP-file save.php:
<?php
$text=$_POST['xyz'];
if ($text){
$connect = mysql_connect("localhost","root","12345") or die("MySQL-connection error.");
mysql_select_db("test") or die("MySQL-database error.");
$query = "INSERT INTO t (text) VALUES ('$text')";
$result = mysql_query($query) or die("MySQL-INSERT error.");
$query = "SELECT * FROM t WHERE text='$text'";
$result = mysql_query($query) or die("MySQL-SELECT error.");
$row=mysql_fetch_row($query);
print("xyz=".$row[0].");
mysql_close($connect);
}
?>