ciao a tutti ho un problemone ma penso sia una cosa semplice che non riesco a capire:
ho realizzato un form in flash8 as2 che passa i dati (nome telefono oggetto etc) a PHP e fin qui tutto bene poi ho inserito un Combobox e sono nati i problemi. Nonostante abbia letto molte discusioni deo dire che non ci ho capito niente. Mi arriva la mail con tutti i dati tranne quello relativo alla scelta fatta cn il combobox. Potete aiutarmi? posto anche il codice
tipoListener = new Object();
tipoListener.change = function(eventObj) {
var eventSource = eventObj.target;
var theSelectedItem = eventSource.selectedItem;
var theSelectedItemlabel = theSelectedItem.label;
trace("Hai scelto "+theSelectedItemlabel+".");
// il trace funziona
};
tipo.addEventListener("change", tipoListener);
errore._visible=false;
pulsinvio.onRelease = function() {
errore.text="";
var corretto:Boolean = true;
//var scelta = combo.getvalue();
// if (scelta=0) {
//testoErrore = "Scegliere un corso";
//scriviErrore(testoErrore);
//corretto = false;
// }
if (Nome.length<2) {
testoErrore = "Inserire un nome valido";
scriviErrore(testoErrore);
corretto = false;
}
if (Telefono.length<2) {
testoErrore = "Inserire N.Telefono";
scriviErrore(testoErrore);
corretto = false;
}
if (Email.text.indexOf("@")<2) {
testoErrore = "E-Mail non valida";
scriviErrore(testoErrore);
corretto = false;
}
if (corretto) {
//trace("invio corretto");
//pulsInvio.onRelease = function(){
var sendMail:LoadVars = new LoadVars();
sendMail.corso = tipo.selectedItem.label;
trace(sendMail.corso);
//il trace funziona
sendMail.nome = Nome.text;
sendMail.telefono = Telefono.text;
sendMail.mittente = Email.text;
sendMail.oggetto = Oggetto.text;
sendMail.richiesta = Richiesta.text;
sendMail.destinatario = "info@miosito.com";
sendMail.onLoad = function(success){
if(success){
Nome.text = '';
Email.text = '';
Telefono.text = '';
Oggetto.text = 'Richiesta inoltrata';
Richiesta.text = '';
mcMsg.mcTxt.txtMsg.text = this.controllo;
mcMsg.play();
}
}
sendMail.sendAndLoad("email.php", sendMail, 'POST');
} else {
errore._visible = true;
}
};
function scriviErrore(stringaErrore:String) {
errore.text = stringaErrore+" ";
}
PHP
<?php
$nome = stripslashes($_POST['nome']);
$corso = stripslashes($_POST['corso']);
$mittente = stripslashes($_POST['mittente']);
$telefono = stripslashes($_POST['telefono']);
$richiesta = stripslashes($_POST['richiesta']);
$sms = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Contatti</title>
</head>
<body style="margin:0px;">
<table cellpadding="0" cellspacing="0" style="height:100%;width:500px;">
<tr>
<td style="height:100%;padding:20px;vertical-align:top;">
<table>
<tr><td colspan="2">
</td>
</tr>
<tr><td width="110">Nome:</td>
<td width="300">'.$nome.'</td></tr>
<tr>
<td>corso:</td>
<td>'.$corso.'</td></tr>
<tr>
<td>Email:</td>
<td>'.$mittente.'</td></tr>
tr>
<td>Telefono:</td>
<td>'.$telefono.'</td></tr>
<tr>
<td>Richiesta:</td>
<td>'.$richiesta.'</td></tr>
</table></td></tr>
</table>
</body>
</html>';
$headers = "From: $nome <$mittente>\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
if(mail($_POST['destinatario'], $oggetto, $sms, $headers)){
echo '&controllo=invio avvenuto con successo.';
}
else{
echo '&controllo=errore: e-mail non inviata.';
}
?>
SONO UN NEOFITA E STO PERDEDO LA TESTA DA TRE GIORNI. PERCHE' NON MI RESTITUISCE QUEL VALORE??