A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: flash to PHP working but...

  1. #1
    Junior Member
    Join Date
    Apr 2003
    Posts
    27

    flash to PHP working but...

    Hi!

    I have this code on flash:
    Code:
    on(release){
    myVars = new LoadVars();
      myVars.nome = "filipe";
      myVars.nick = "light";
      myVars.mail = "ribeiro";
              myVars.send("http://localhost/form.php", "_blank", "[GET]");
    }
    And the PHP code is the following:
    Code:
    if(!empty($_GET['nome']) && !empty($_GET['nick']) &&  !empty($_GET['mail']))
        {
            $conn = mysql_connect('localhost', 'hribeiro', 'eyewtkas') or die(mysql_error());
            $db = mysql_select_db('test', $conn) or die (mysql_error());
            $nome = $_GET['nome'];
            $nick = $_GET['nick'];
            $mail = $_GET['mail'];
    		
            $result =  mysql_query("INSERT INTO users (nome, nick, mail)
                        VALUES ('$nome', '$nick', '$mail')") or die(mysql_error());
            if($result)
                {
                    echo "Everything is ok";
                } else {
                    echo "Error writing data";
                }
            mysql_close($conn);
        } else{
    	echo "houve aqui merda";
    	};
    It works pretty good. However, with send() the variables will be visible in the php URL, and i dont want that. I've tried with sendAndLoad but in that way haven't managed work it out.

    Can anyone help me?
    Thank you

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,046
    use POST instead of GET

  3. #3
    Junior Member
    Join Date
    Apr 2003
    Posts
    27
    but using POST it seems it doesn't work anymore! and the variables are still in the URL

  4. #4
    a.k.a gltovar deadlock32's Avatar
    Join Date
    May 2001
    Location
    Naperville,IL
    Posts
    489
    I apologize if you are trying to get your page to load with out any kind of refresh but a simple way to do this (if you dont have many vars to pass) is
    Code:
    getURL("./foo.php?somevar="+someFlashVar);
    so instead of relying on flash's get proceedure you are 'hard typing' the url.

    EDIT: sorry, I forgot that you want to use a method that hides the vars in the URL bar so my input isnt much use
    Last edited by deadlock32; 05-30-2006 at 01:37 PM.

  5. #5
    Junior Member
    Join Date
    Apr 2003
    Posts
    27
    thanks anyway deadlock32.
    can anyone help me?

  6. #6
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Have no fear...there is light at the end of the tunnel

    Code:
    on(release){
    
     var result_lv= new LoadVars();
        result_lv.onLoad = function(success) {
        if (success) {
         // do something....it's all good
        } else {
            //do something else...it's all bad
        }
        };
        var send_lv = new LoadVars();
        send_lv.nome = "filipe";
        send_lv.nick = "light";
        send_lv.mail = "ribeiro"; 
        send_lv.sendAndLoad("http://localhost/form.php", result_lv, "POST");
      
     }

  7. #7
    Wannabe PHP Wizard
    Join Date
    Nov 2001
    Location
    Leechburg, PA
    Posts
    129
    Also, don't forget to change your PHP script so that it accepts $_POST data instead of $_GET data.
    Clinton N Godlesky
    My Stuff:
    http://www.15656.com/clint http://www.statedirt.com
    Personal Development Projects:
    http://www.15656.com/dev

  8. #8

  9. #9
    Junior Member
    Join Date
    Apr 2003
    Posts
    27
    thank you vary much! its finally working!

  10. #10

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