Integrating Flash with PHP :
Integrating Flash with PHP :
we can create flash form with the fields Name, Email, Subject, Message and Send button.We can connect “Send” button from our flash form to Php script for database manipulation.
The action script on Send button in flash application will beon(release)
{
clip1.loadVariables(”http://localhost/first/flash/send.php”,”POST”). //Syntax : MovieClip.loadVariables(url,[method]).
}
In url we have to give the php script name and method may be POST or GET.
In send.php script, we can use MYSQL for database connection and then we
can do all the database operations which we need.
Here is the “send.php” script:
@extract($_GET);
@extract($_POST);
/** Database Connection **/
$link = mysql_connect(”localhost”, “root”, “”)
or die(”Could not connect”);
mysql_select_db(”flash”);
/** Check whether user is present for that email **/
$sql = mysql_query(”select * from user where email= ‘$uemail’”);
$c = mysql_num_rows($sql);
$res = mysql_fetch_row($sql);
if($res != “”)
{
// Sending Mail status to Flash
echo “mail_status=sent&”;
/** Sending Mail if user is present **/
$to=$uemail;
$subject=”Mail from Flash”;
$message=”This is integrating Flash with PHP message”;
$option=”From: pgmr20@gmail.com”;
mail($to,$subject,$message,$option);
}
else
{
// Sending Mail status to Flash
echo “mail_status=notsent&”;
}
?>
In above example we can can check whether any user is available for the given mail-id(from flash). If present, mail will be send to that user and status will be send to flash. If mail sent you can view the
mail_status as “Mail Sent Successfully”, Otherwise, you can view “No user exists” in
Flash application.
