2 Replies Latest reply on Aug 30, 2011 1:37 AM by alokjk

    Flex $_POST not working

    alokjk

      OK, so I'm working on an app which allows users to log in, when they've logged in it redirects them to another page. The page they are redirected to however needs to know their id, which I'm guessing can only be done securely via POST or SESSION, I prefer POST.  I have this code so far:

       

      Flex/AS3:

      <fx:Script>
                <![CDATA[
                     import flash.net.navigateToURL;
                     
                     import mx.controls.Text;
                     import mx.rpc.events.ResultEvent;
                     
                     private var loginID:String;
                     
                     private function checkLogin(event:ResultEvent):void
                     {
                          loginID = event.result.loginsuccess.toString();
                          if(event.result.loginsuccess != "no")
                          {
                               var data:Object = new Object();
                               data.id = loginID;
                               var request:URLRequest = new URLRequest("http://myurl.com/startPage.php");
                               request.contentType = "text";
                               request.data = data;
                               request.method = URLRequestMethod.POST;
                               
                               navigateToURL(request, "_self");
                          }
                          if(event.result.loginsuccess == "no")     
                               navigateToURL(new URLRequest("http://mybox.dyndns-web.com/Petty/incorrectLogin.php"), "_self");
                     }          
                     private function register(evt:ResultEvent):void
                     {
                          if(evt.result.regsuccess == "yes")
                               navigateToURL(new URLRequest("http://mybox.dyndns-web.com/Petty/registerSuccess.php"), "_self");
                          if(evt.result.regsuccess == "no")
                               navigateToURL(new URLRequest("http://mybox.dyndns-web.com/Petty/registerFail.php"), "_self");
                     }
                ]]>
           </fx:Script>
      

       

      PHP - I just want to display the ID for now:

      <?php     
      
      echo $_POST["id"];
      
      ?>
      

       

      But at the moment when the user lands on the PHP page they see an error:

       

      Notice: Undefined index: id in C:\xampp\htdocs\startPage.php on line 3

       

      Where am I going wrong? Please help, I need this fixed ASAP!