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!

Flash Form Posting To PHP Script 1

Status
Not open for further replies.

thirtyottsixx

Technical User
Aug 7, 2002
27
US
Hello... I'm having a bit of trouble posting data to this php script from flash. This is my first try at this.

Here's my PHP Script:

<?

if ($esubmit) {

$qid = db_query("select * from newsletter where email = '$email'");
$num_rows = db_num_rows($qid);
if ($num_rows || $email == "") {
$_SESSION[system_message] = "Sorry, That email address is already in our database.";
} else {
db_query("insert into newsletter (email) values ('$email')");
$_SESSION[system_message] = "Thank you!<br><br> $email has been added to our mailing list.";
}
}

if ($unsubscribe == "true" && $email != "" && $id != "") {
db_query("delete from newsletter where email = '$email' and $id = '$id'");
$_SESSION[system_message] = "$email has been REMOVED from our mailing list.";
}
?>

According to a tutorial I read, I need to set the variable.
So in the first keyframe I have:

email = "";

Then for the button actions I have:

on (release) {
getURL("join.php", "", "POST");
}

I also have the instance name of the button set to esubmit, not sure if that makes a difference.

I uploaded my test.fla here if that helps:

Any responses are appreciated.
 
That PHP script looks like it was meant to deal with output from an HTML form - hence the $esubmit variable. Naming a button in your Flash movie to 'esubmit' won't send the value needed to trip this condition in the PHP but you can send a variable of the same name which should do the trick:

Code:
esubmit=true

Either that or amend the PHP to remove the first if statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top