allora... utilizzo flash8 as2
ho inserito un combobox in flash in un form già funzionante.
o rovato in locale e funziona con il seguente controllo mi dice che la voce selezionata è corretta.
RISULTATO TRACE
Hai scelto1 Avviare un'attività imprenditoriale.
scelta3 Avviare un'attività imprenditoriale.
il problema nasce dalla mail che ricevo
Nome: Fulmine Landucci
corso:
Email: info@ccopp.it
Telefono: 12345646
Richiesta: blablabla
non arriva il campo corso. Perche ? dipende dal file PHP ?
di seguito AS2 e PHP
pnso dipenda dal PHP ma ci capisco poco
stop();
var tipoScelto; // questa var deve stare fuori dal gestore qua sotto
var tipoListener:Object = new Object();
tipoListener.change = function(eventObj) {
var t = tipo.selectedIndex;
tipoScelto = tipo.getItemAt(t).label;
trace("Hai scelto1 "+tipoScelto+".");
};
tipo.addEventListener("change", tipoListener);
errore._visible=false;
pulsinvio.onRelease = function() {
errore.text="";
var corretto:Boolean = true;
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) {
var sendMail:LoadVars = new LoadVars();
var risultati:LoadVars = new LoadVars();
sendMail.nome = Nome.text;
sendMail.corso = tipoScelto;
trace("scelta3 "+sendMail.corso+".");
sendMail.telefono = Telefono.text;
sendMail.mittente = Email.text;
sendMail.oggetto = Oggetto.text;
sendMail.richiesta = Richiesta.text;
sendMail.destinatario = "info@giranapoli.com"; // mettete qui l'email del destinatario
risultati.onLoad = function(success){
if(success){
Nome.text = '';
scelta = '';
Email.text = '';
Telefono.text = '';
Oggetto.text = 'Richiesta inoltrata';
Richiesta.text = '';
mcMsg.mcTxt.txtMsg.text = this.controllo;
mcMsg.play();
}
}
sendMail.sendAndLoad("email.php",risultati,'POST') ;
} else {
errore._visible = true;
}
};
function scriviErrore(stringaErrore:String) {
errore.text = stringaErrore+" ";
}
il 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.';
}
?>