# POST variables from external source (Flash)

**URL:** https://forum.kirupa.com/t/post-variables-from-external-source-flash/323921
**Category:** programming
**Created:** [July 24, 2011, 2:56pm UTC](https://forum.kirupa.com/t/post-variables-from-external-source-flash/323921 "2011-07-24T14:56:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![45\_ACP](https://avatars.discourse-cdn.com/v4/letter/4/c4cdca/32.png) [@45\_ACP](https://forum.kirupa.com/u/45_ACP)
#### Post date: [July 24, 2011, 2:56pm UTC](https://forum.kirupa.com/t/post-variables-from-external-source-flash/323921/1 "2011-07-24T14:56:22Z")

</div>

Hi,

I’m having trouble with a script of mine which should work, but doesn’t for a reason that escapes me. I’m using a sendAndLoad function within Flash to, well, send and load variables to a .php file using POST. The problem is that it works, but only once. Basically, I’m trying to create a user login page within Flash, and I want the user to be able to try logging in multiple times: the first time, the script works, but if the user fails to authenticate the first time and tries again, the script fails to work properly again.

Server-side script:

```php
if ($_POST['data']=="login") {
    $query = "SELECT * FROM Members WHERE Name='" . $_POST['name'] . "'";
    $answer = mysql_query($query);
    if ($row = mysql_fetch_array($answer)) {
        $team = $row['Team'];
        $name = $row['Name'];
        $pass = $row['Password'];
        if ($_POST['pass'] == $pass) {
            echo "&result=success";
        } else if ($_POST['pass'] != $pass) {
            echo "&result=passfail";
        }
    } else {
        echo "&result=userfail";
    }
}

```

As far as I’m concerned, I’m simply a bit ignorant about the way PHP sends and receives information via POST. So what am I forgetting about?

Thanks!
