Flash PHP Tutorial: How To Insert Data From Database Using Flash with PHP

This video learn how to insert data from database using Flash with PHP.



1- Watch Related Video
https://www.youtube.com/watch?v=jgQpnL3ip9E

2- Create file new_student.php in XAMPP ('C:\xampp\htdocs\phpflash')

<?php
      //Capture data from $_POST array
      $name = $_POST['Fullname'];
      //Connection to database
      $connect = mysql_connect("localhost", "root", "");
      mysql_select_db ("mydb", $connect);
      //Perform the query
      $result = mysql_query("INSERT INTO students (fullname) VALUES ('$name')");
?>

3- Create flash project "new_student.fla"

- Insert Text Tool and then set instance name 'Fullname'
- Insert Button from Components and then set instance name 'submit'

Write codes in Actions - Frame

submit.addEventListener("mouseDown", sendData);
function sendData(evt:Event)
{
//for those using PHP
var students:URLRequest = new URLRequest("http://localhost/phpflash/new_student.php");
students.method = URLRequestMethod.POST;
var posts:URLVariables = new URLVariables();
posts.Fullname = Fullname.text;
students.data = posts;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(students);
}

4- demo
http://downloads.ziddu.com/download/24366374/phpflash_1.zip.html

Read more blog:
http://video-tutorial-from-youtube.blogspot.com/

Follow Us with Facebook
https://www.facebook.com/pages/PHP-Tutorial/782239958529506

Share this

Related Posts

Previous
Next Post »