Simple flash/php form to create database

Posted on 2011-03-01
Last Modified: 2013-11-11
I need to create a simple form in flash that a user will fill out and on submit will create a new database and fill it with the form data using php and mqsql. Does anyone have some sample code to this effect?
Question by:brettacvh
  • 3
  • 3
LVL 17

Assisted Solution

by:Dushan De Silva
Dushan De Silva earned 500 total points
ID: 35012808

Author Comment

ID: 35012846
To be a bit more detailed I need my flash form to run the following kind of query:

CREATE TABLE  `new`.`users` (
  `test_uid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `test_email` varchar(100) NOT NULL,
  `test_address` varchar(45) DEFAULT NULL,
  `test_message` varchar(45) DEFAULT NULL,
  `ipaddress` varchar(45) DEFAULT NULL,
  `test_pword` char(20) NOT NULL,
  `test_gname` char(80) NOT NULL,
  `test_lname` char(80) NOT NULL,
  `test_active` char(1) DEFAULT 'y',
  `test_lvl` int(10) unsigned NOT NULL DEFAULT '1',
  `test_rdate` datetime DEFAULT NULL,
  `test_username` varchar(45) NOT NULL,
  `test_permission` varchar(45) NOT NULL DEFAULT '1',
  `test_contactno` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`pogu_uid`)

Open in new window

but I'm not sure how to structure the php.

For the flash I guess I'll be using something like this:

submit1.onPress = function(){
	myData.test_uid_txt = test_uid_txt.text
		myData.test_email_txt = test_email_txt.text
		myData.test_address_txt = test_address_txt.text
		myData.sendAndLoad("form.php", myData, "POST")

Open in new window

 ... etc

Author Comment

ID: 35013239
Apologies. I am incorrect. I don't need to be creating the database but rather updating an existing database with:

insert into users(pogu_username,

Open in new window

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

LVL 17

Accepted Solution

Dushan De Silva earned 500 total points
ID: 35013267

Above SQL statement you should not run from flash in normal practice. You should create database table using phpmyadmin, mysql gui or some other mysql client interface.

Then use php script to insert values to database which captures from the flash form.

BR Dushan.
LVL 17

Assisted Solution

by:Dushan De Silva
Dushan De Silva earned 500 total points
ID: 35013337
Please find below sample code.
----------------------------------------------flash code ---------------------------------------------
var submitObject:LoadVars = new LoadVars();

submit1.onRelease = function():Void

     submitObject.myname = myname.text;
     submitObject.mycontact = mycontact.text;
     submitObject.myabout = myabout.text;
     submitObject.mymessage = mymessage.text;
     submitObject.send("", "_self", "POST");

----------------------------------------------php code ------------------------------------------------
$conn = mysql_connect("local host", "username", "password");
mysql_select_db("blc", $conn);
$myname = $_POST['myname'];
$mycontact = $_POST['mycontact'];
$myabout = $_POST['myabout'];
$mymessage = $_POST['mymessage'];

$query="INSERT INTO contacts values ('', '$myname', '$mycontact', '$myabout', '$mymessage')";
$sql_run = mysql_query($query, $conn) or die(mysql_error());


Open in new window


Author Comment

ID: 35014038
To add to my question: how do I validate the radio buttons in the flash form? I have 2 radio buttons with a group name of my_vars.gender The code I am trying is

if (my_vars.gender.selection == undefined) 

Open in new window

but doesn't work

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question