Hi guys,
I have made a form which when sent to a Mysql server adds a table to a database.
Here is the code that I use in Flash Builder:
...
<mx:HTTPService id="srv" url="http://mysite.com/addTeam.php" method="POST">
<mx:request>
<teamName>{teamName.text}</teamName>
<city>{city.text}</city>
</mx:request>
</mx:HTTPService>
... <mx:Form x="25" y="10"> <mx:FormHeading label="Add a team"/> <mx:FormItem label="Team name"> <s:TextInput id="teamName"/> </mx:FormItem> <mx:FormItem label="City"> <s:TextInput id="city"/> </mx:FormItem> <mx:FormItem> <s:Button label="Add" click="srv.send()"/> </mx:FormItem>
And here is my addTeam.php file:
<?php
$teamName = $_POST['teamName'];
$city = $_POST['city'];
$addteam = $teamName ." ". $city;
$connection = mysqli_connect("host", "username", "password", "db") or die(mysqli_connect_error());
mysqli_query($connection, "SET CHARACTER SET utf8"); //the added table will be in bulgarian language
$sql = "CREATE TABLE `$addteam`
(
FirstName varchar(20),
SurName varchar(20),
LastName varchar(20),
position varchar(20),
price int
)
";
mysqli_query($connection, $sql) or die ("Query failed: " . mysqli_error($connection));
?>
My question is: How can I return some text to Flash Builder if the query was successful or failed (like "echo") so that the user (admin in this case) knows what is going on and not just clicking the add button and having to go to phpmyadmin to see if the table has been created or not?