Problème Formulaire AS2/php

cs_a44icus Messages postés 31 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 23 mars 2013 - 6 févr. 2009 à 09:32
cs_a44icus Messages postés 31 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 23 mars 2013 - 6 févr. 2009 à 16:02
Bonjour, j'ai un problème avec mon formulaire flash/php. Quand je clique sur le bouton envoyer il se passe quelque chose avec le serveur mais je ne reçois pas de mail... Je vous montre mon code AS2 et php.. si vous trouvez une solution .. Merci

Code AS2

stop();
// --------------------------------------------------------------
// función que valida números
// --------------------------------------------------------------
String.prototype.isNumbers = function() {
    if (this.length<1) {
        return false;
    }
    for (i=0; i<this.length; i++) {
        code = this.charCodeAt(i);
        if (this.charAt(i) != " " && code<48 || code>57) {
            return false;
        }
    }
    return true;
};
// --------------------------------------------------------------
// valida mails
// --------------------------------------------------------------
String.prototype.isMail = function() {
    if (this.indexOf("@")>0 && this.indexOf("@") == this.lastIndexOf("@")) {
        if (this.lastIndexOf(".")>this.indexOf("@")+1 && this.lastIndexOf(".")<this.length-2) {
            return true;
        }
    }
};
// --------------------------------------------------------------
// función que limpia los campos
// --------------------------------------------------------------
function limpiar() {
    nom = "";
    tel = "";
    mail = "";
    msg = "";
    mensaje_error =""
}
// --
nom.tabIndex = 1;
tel.tabIndex = 2;
mail.tabIndex = 3;
msg.tabIndex = 4;
// --
nom.borderColor = 0xE7EFF7;
tel.borderColor = 0xE7EFF7;
mail.borderColor = 0xE7EFF7;
msg.borderColor = 0xE7EFF7;
//
nom.onSetFocus = function() {
    mensaje_error = "";
    nom.backgroundColor = 0xE7EFF7;
    nom.borderColor = 0x4A869C;
};
nom.onKillFocus = function() {
    nom.backgroundColor = 0xdcdcdc;
    nom.borderColor = 0xE7EFF7;
};
// --
tel.onSetFocus = function() {
    mensaje_error = "";
    tel.backgroundColor = 0xE7EFF7;
    tel.borderColor = 0x4A869C;
};
tel.onKillFocus = function() {
    tel.backgroundColor = 0xFdcdcdc;
    tel.borderColor = 0xE7EFF7;
};
//
mail.onSetFocus = function() {
    mensaje_error = "";
    mail.backgroundColor = 0xE7EFF7;
    mail.borderColor = 0x4A869C;
};
mail.onKillFocus = function() {
    mail.backgroundColor = 0xdcdcdc;
    mail.borderColor = 0xE7EFF7;
};
//
msg.onSetFocus = function() {
    mensaje_error = "";
    msg.backgroundColor = 0xE7EFF7;
    msg.borderColor = 0x4A869C;
};
msg.onKillFocus = function() {
    msg.backgroundColor = 0xdcdcdc;
    msg.borderColor = 0xE7EFF7;
};
//
bouton.onRollOver = bLimpiar.onRollOver=function () {
    this.gotoAndPlay("sobre");
};
bouton.onRelease = function() {
    var envoyer:LoadVars = new LoadVars();
    envoyer.nom=nombre.text;
    envoyer.tel=tel.text;
    envoyer.mail=mail.text;
    envoyer.msg=msg.text;
    envoyer.onLoad = function(exito) {
        if (envoyer.ok=="true"){
            msgServidor.text="Message sent successfully";
        }else{
            msgServidor.text="I'm sorry, we can not send your message right now, but, you can retry later."
        }
    }
    envoyer.sendAndLoad("envoi.php", envoyer, "POST");
   
   
    /*if (nom.length<1) {
        mensaje_error = "Por favor introduzca su nombre";
    } else if (telefono.length<1 or telefono.isnumbers() == false) {
        mensaje_error = "Por favor, introduzca un teléfono de contacto";
    } else if (!mail.text.isMail()) {
        mensaje_error = "Por favor, introduzca e-mail válido";
    } else {
        loadVariablesNum("form.php", 0, "POST");
        mensaje_error = "Mensaje enviado";
    }*/
};
// --
bLimpiar.onRelease = function() {
    limpiar();
};

CODE PHP

<?php

$nom=$HTTP_POST_VARS['nom'];
$mail=$HTTP_POST_VARS['mail'];
$numtel=$HTTP_POST_VARS['tel'];

 
$message  = " Nom Prenom        : \t ";
$message .="$nom \n ";

$message .= "Adresse Mail      : \t ";
$message .="$mail \n ";

$message .= "Numero Telephone  : \t ";
$message .="$tel \n ";
$message .= "Message  : \t ";
$message .=$HTTP_POST_VARS['msg'];

$destinataire=a44icus@gmail.com;
$sujet = "Test PHP Flash";

/*function decoder($texte){
    $texte = utf8_decode($texte);
    $texte = stripslashes($texte);
    $texte = trim($texte);
    $texte = htmlentities($texte, ENT_QUOTES);
    $texte = strip_tags($texte);
    $texte = nl2br($texte);
    $texte = str_replace("&gt;", ">", $texte);
    $texte = str_replace("&lt;", "<", $texte);
    return $texte;
}

$sujet = decoder($sujet);
$message = decoder($message);
*/
$headers = $sujet;

$mail_OK=mail($destinataire, $sujet, $message, $headers) ;

if ($mail_OK) {
    echo "resultat=Envoi effectué";
} else {
    echo "resultat=Probleme lors de l'envoi ou @mail non valide";
}

?>

/////a44icus/////

3 réponses

cs_Burnside Messages postés 1132 Date d'inscription mercredi 28 août 2002 Statut Membre Dernière intervention 6 mars 2020
6 févr. 2009 à 13:35
Slt,

Déja cette ligne :

[mailto:$destinataire=a44icus@gmail.com $destinataire=a44icus@gmail.com]; il manque les '

j'espère que tu comprend l'español, sinon

Limpiar = nettoyer
sobre = sur ou enveloppe

Bàt,
Burnside.

..:: Enjoy living in hell ::..
http://www.art-line.be
0
cs_a44icus Messages postés 31 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 23 mars 2013
6 févr. 2009 à 14:59
Ok, merci j'avais pas fait attention au ( ' ). Maintenant je reçois quelque chose mais il reste un problème, je rempli bien tous les champs mais dans le mail je recois ceci :

Nom        :     undefined

Adresse Mail      :     undefined

Numero Telephone  :     undefined

Message  :      undefined

/////a44icus/////
0
cs_a44icus Messages postés 31 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 23 mars 2013
6 févr. 2009 à 16:02
Si sur mes champs je mes le même nom d'occurrence et de variable sa gène

/////a44icus/////
0
Rejoignez-nous