Calling session (user)
Hi guys,
I want to display the user name in the dynamic textfield on the login success page (new page) but it keeps giving me 'undefined'. What's the problem?
login.php
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
$_SESSION['username'] = $username;
. //other codes
.
.
?>
adminPage.php (successpage)
<?php
session_start();
$_SESSION['username'] = $_POST['username'];
$username = $_GET['username'];
print "session=$username";
?>
AS3
import flash.display.*;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequestMethod;
var phpVarsSession:URLVariables = new URLVariables();
var phpFileRequestSession:URLRequest = new URLRequest("adminPage.php");
phpFileRequestSession.method = URLRequestMethod.POST;
var phpLoaderSession:URLLoader = new URLLoader();
phpLoaderSession.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoaderSession.addEventListener(Event.COMPLETE, showSession);
phpVarsSession.user = user.text;
phpFileRequestSession.data = phpVarsSession;
phpLoaderSession.load(phpFileRequestSession);
function showSession(event:Event):void
{
user.text = "" + event.target.data.session;
}
