# Another LoadVars problem

**URL:** <https://forum.kirupa.com/t/another-loadvars-problem/65524>\
**Category:** Uncategorized\
**Created:** [September 27, 2004, 11:52am UTC](https://forum.kirupa.com/t/another-loadvars-problem/65524 "2004-09-27T11:52:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmerens](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bmerens](https://forum.kirupa.com/u/bmerens)\
**Post date:** [September 27, 2004, 11:52am UTC](https://forum.kirupa.com/t/another-loadvars-problem/65524/1 "2004-09-27T11:52:38Z")

</div>

I try to get a variable from php :

I have a boutton with :

on (release) {

```
              $myLoadVars = new LoadVars();
              $myLoadVars_received = new LoadVars();

              $myLoadVars.var_to_php = myComboBox.getSelectedItem().label; 

```

$myLoadVars.sendAndLoad ( “script.php”,$myLoadVars\_received);

$affich\_var = $envelope\_received.var\_from\_php;  
}

PHP //  
script.php :

\<?  
$result = mysql\_query( “select counter from data\_base where data1=’”.$\_POST[‘var\_to\_php’]."’");

$counter = mysql\_fetch\_row($result);

echo ("&var\_from\_php=$counter[0]");  
?\>

=\> my result of all this : nothing happens. no variable is received from php. ( the is no request ( from the firewall ) from flash to access the internet )

so I think the error is around the sendandload.

any suggestions ???

by the way, the php script works perfectly with loadVariablesNum

thanks for your help!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 27, 2004, 1:55pm UTC](https://forum.kirupa.com/t/another-loadvars-problem/65524/2 "2004-09-27T13:55:15Z")

</div>

Salut,

What’s $enveloppe\_received supposed to be? It it’s the data you want to receive, you’ll have to declare an onLoad handler.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 27, 2004, 1:58pm UTC](https://forum.kirupa.com/t/another-loadvars-problem/65524/3 "2004-09-27T13:58:34Z")

</div>

I’m not 100% sure this will work but, try the below code.

```php
<?
$result = mysql_query( "select counter from data_base where data1=$_POST['var_to_php']");

$counter = mysql_fetch_row($result);

echo ("&var_from_php=$counter[0]");
?>

```

Also make sure your var (var\_to\_php) is successfully outputting from Flash.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 27, 2004, 2:07pm UTC](https://forum.kirupa.com/t/another-loadvars-problem/65524/4 "2004-09-27T14:07:38Z")

</div>

i just did the tutorial with the $envelope\_reieved var too 😃  
If you redefined your reciever LoadVar Object … you should change with “$myLoadVars\_received” everywere :), including in that line “$affich\_var = [color=red]$envelope\_received[/color].var\_from\_php;  
”

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 27, 2004, 8:32pm UTC](https://forum.kirupa.com/t/another-loadvars-problem/65524/5 "2004-09-27T20:32:56Z")

</div>

ok ok !!! i checked the AS and actually I have not $envelope but $affich\_var = $myLoadVars\_received.var\_from\_php;

reponse tu nerrain : there is no difference between my code and what you suggested !!! or am I blind !!! ( oh my GOOD I might be blind !!! or behaps not 🙂 )

any other solution ?

shall I " declare an onLoad handler" from Ilyas Premier  
Motion Tween Guru ??? can anyone give me an exemple because I don’t see what he means ☹

thanks 🙂
