Bonjour a tous,
J'ai un problem pour recevoir mes données en PHP. Voici le code coté flash (repris d'un exemple)
var result_lv:LoadVars = new LoadVars();
var login_lv:LoadVars = new LoadVars();
// copy the value of the two TextInput components into the login_lv LoadVars instance.
login_lv.username = pseudo.text;
login_lv.password = pwd.text;
/* send the variables in the login_lv instance to the server-side script
using the POST method (send as Form variables rather than along the URL)
and place the results returned in the result_lv instance. */
login_lv.sendAndLoad("http://localhost/login.php", result_lv, "POST" );
// When the results are received from the server...
result_lv.onLoad = function(success:Boolean) {
// If Flash is able to successfully send and load the variables from the server-side script...
if (success) {
// if the server returned the value of isValidLogin with a value of 1...
if (this.isValidLogin == 1) {
/* set the status_lbl Labal to a "success" message.
Typically here you'd do a gotoAndPlay or set any local variables
related to a successful login. */
status_lbl.text = "login successful.";
/* else the login information wasn't valid,
therefore display an error message in the status_lbl Label instance. */
} else {
status_lbl.text = "invalid user name / password.";
// set the form focus to the pseudo TextInput instance and select the existing text.
Selection.setFocus(pseudo);
Selection.setSelection(0, pseudo.text.length);
}
/* this code is only executed if for some reason the SWF is
unable to connect to the remote page defined in LoadVars.sendAndLoad */
} else {
status_lbl.text = "Unable to connect to login URL";
pseudo.enabled = false;
pwd.enabled = false;
// submit_btn.enabled = false;
}
status_lbl.text = this.mess;
Je pense que le problem vient de PHP:
$pseudo = $_POST['pseudo'];
if($pseudo){
parse("mess","OK" );
}else{
parse("mess","NOK" );
}
Si j'affiche la page php j'ai une erreur avec le _POST, si je mets _GET c'est bon je n'ai plus d'erreur. Mais dans les deux cas je recupere coté flash NOK.
Merci de votre aide.
Message édité par Muray le 10-12-2007 à 10:44:19