PHP MySQL n Flash

Hello all!

I’m trying to do some basic flash actionscript comunication with a mysql database via php.
codes are as following:

The Flash part:

//no reason to have delete button invisible to start with...a whim on my part
deleteB._visible = false;
//add a record to the database
addButton.onRelease = function() {
    myData = new LoadVars();
    myData.quantity = quantity.text;
    myData.product = product.text;
    //you must change the url in the next line to your own
    myData.sendAndLoad("add.php", myData, "POST");
    quantity.text = "";
    product.text = "";
    myData.onLoad = refresh;
display.onRelease = refresh;
//update the database display every time a change is made
function refresh() {
    deleteB._visible = false;
    myLoader = new LoadVars();
    myLoader.ran = random(999);
    //again change the next line
    myLoader.sendAndLoad("loader2.php", myLoader, "POST");
    myLoader.onLoad = function() {
        for (i=0; i<this.n; i++) {
            messages.addItem(this["product"+i]+"		"+this["quantity"+i], this["_id"+i]);
            total.text = messages.getLength();
//user selects an item in the list box
function messHandler() {
    result = messages.getSelectedItem();
    id.text =;
    prod.text = result.label;
    deleteB._visible = true;
//user searches for a product
search.onRelease = function() {
    id.text = "";
    prod.text = "";
    _s = new LoadVars();
    _s.word = searchbox.text;
    //and change
    _s.sendAndLoad("search3.php", _s, "POST");
    _s.onLoad = function() {
        searchbox.text = ""
        if(this.n==0) messages.addItem("Product Not Found");
        for (i=0; i<this.n; i++) {
            messages.addItem(this["product"+i]+"		"+this["quantity"+i], this["_id"+i]);
            total.text = messages.getLength();
//delete a record...cannot be undone
deleteB.onRelease = function() {
    id.text = "";
    prod.text = "";
    delDat = new LoadVars();
    delDat.toDelete = messages.getSelectedItem().data;
    deldat.ran = random(999);
    //and change
    delDat.sendAndLoad("delete.php", delDat, "POST");
    deldat.onLoad = refresh();
//some formating for list box and text boxes
id.background =prod.background=total.background=product.background=quantity.background=searchbox.background=true;
id.backgroundColor =prod.backgroundColor=total.backgroundColor=product.backgroundColor=quantity.backgroundColor=searchbox.backgroundColor=0x123456;
myStyle = new FStyleFormat();
myStyle.arrow = 0xffffff;
myStyle.face = 0x123456;
myStyle.scrollTrack = 0x456789;
mystyle.background = 0x123456;
mystyle.textColor = 0xffffff;
mystyle.selection = 0xff0000;

The PHP part ( i will only post add.php )



$quantity = $HTTP_POST_VARS['quantity'];
$product = $HTTP_POST_VARS['product'];
$sql_query = mysql_query("INSERT INTO produce(product, quantity) VALUES ('$product', '$quantity')") or die (mysql_error()); 


The MySQL DB contains, as you may guess, a table called produce with 2 fields, product and quantity

I include my swf file in a html file, located in the same directory as add.php, access it through localhost. The problem is, it is adding a new record in the database, but the fields ( product and quantity ) are blank. Could someone give me a hand with this?

Thank you for your patience