A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: send var from php to flash

  1. #1
    Member
    Join Date
    Mar 2002
    Posts
    68

    send var from php to flash

    hello i am just trying to figure out how to send a var from php into flash. i have a texfield var name ip and the code


    <?PHP
    if ($REMOTE_ADDR == ""){
    $ip = "no ip";
    } else {
    $ip = getHostByAddr($REMOTE_ADDR);

    print "ip = $ip"

    ?>


    in a php file called IP.php

    what i wan't to do it have it sent the persons ip address into flash.
    is the print part correct as something is not working. to receive the var i am doing

    on (release) {
    loadVariablesNum("IP.php", 0, "POST");
    }


    is this right. if anyone could help that would be greatly appreciated. Thanks. Patrick

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    get rid of the spaces here:
    print "ip=$ip";

    Also, if your server runs php 4.1 or later, the $REMOTE_ADDR should be a $_SERVER["REMOTE_ADDR"]

    Musicman

  3. #3
    Member
    Join Date
    Mar 2002
    Posts
    68
    hello, i can't even get it to sent just plain text. i am not good at php and i am trying to learn. why would the flash not get the info.

    when i open up just the flash i get this


    Parse error: parse error in /usr/local/plesk/apache/vhosts/downquillow.com/httpdocs/Mail/IP.php on line 9


    what does this mean. Thanks for the help. Patrick

  4. #4
    Official FK nice guy and MOD 3PRIMATES's Avatar
    Join Date
    Apr 2002
    Location
    Portland Oregon
    Posts
    1,645
    Hi,

    you were missing a ; at the end of the print line..
    You were missing an ending } after this line:
    $ip = getHostByAddr($get_ip);

    Here:

    PHP Code:
    <?php

    $get_ip 
    $_SERVER["REMOTE_ADDR"];

    if (
    $get_ip == ""){
    $ip "no ip";
    }
    else
    {
    $ip getHostByAddr($get_ip);
    }

    print 
    "&ip=$ip";

    ?>
    If you get confused with where to place braces in an if statement, think about it this way

    the braces enclose what you want to want to happen
    In example:
    PHP Code:
    if ($get_ip == "")

    {
    $ip "no ip";}

    else

    {
    $ip getHostByAddr($get_ip);} 
    Remember not to code this way though, although it will work, it is considered bad codeing practice

    Have fun..

    3PRIMATES

  5. #5
    Member
    Join Date
    Mar 2002
    Posts
    68
    thanks a lot. I got the script to work. I haveone more question though. to load the php from a different web could you do this

    loadVarNum(www.somesite.com/IP.php, 0, "POST")

    and be calling that script from another site. or how do you get it from one folder down.

    I can't get that to work. is this posiblt to load varibles from one site to another. Thanks for all the help. Patrick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center