- Home
- Categorie
- Digital Marketing
- Grafica, Visual Design & UX
- Form con checkbox
-
Form con checkbox
Sto cercando di imparare ad usare i checkbox e sto cercando anche di migliorarmi nella creazione dei form...
Vi spiego:
ho creato un form con questi campi:
Nome ----> nome istanza nome_txt
Cognome ----> nome istanza cognome_txt
Azienda ----> nome istanza azienda_txtTelefono ----> nome istanza tel_txt
email ----> nome istanza email_txt
Città ----> nome istanza citta_txtore ----> nome istanza ore_txt
minuti ----> nome istanza minuti_txte poi ho aggiunto quattro caselle checkbox prese dai componenti di flash
A) ----> nome istanza checka_txt
B) ----> nome istanza checkb_txt
C) ----> nome istanza checkc_txt
D) ----> nome istanza checkd_txtpoi nel fotogramma chiave vuoto ho messo questo codice:
stop(); function resetCampo() { nome_txt.inputColor("0x000000", "0x000000");
cognome_txt.inputColor("0x000000", "0x000000"); azienda_txt.inputColor("0x000000",
"0x000000"); tel_txt.inputColor("0x000000", "0x000000"); email_txt.inputColor( "0x000000",
"0x000000"); citta_txt.inputColor( "0x000000", "0x000000"); ore_txt.inputColor(
"0x000000", "0x000000"); minuti_txt.inputColor( "0x000000", "0x000000");
Selection.setFocus(undefined); }
limpar_bt.onRelease = resetCampo; enviar_bt.onRelease =
function() { mailTrue = email_txt.text;
//else { //php_nome = _root.nome_txt.text;
//php_email = _root.email_txt.text; //php_msg = _root.msg_txt.text;
loadVariables("output.php", this, "POST"); status_txt.text = "INVIATO!";
nome_txt.inputColor("NOME:", "0x666666", "0x000000");
email_txt.inputColor("EMAIL:", "0x666666", "0x000000"); msg_txt.inputColor("MESSAGGIO:", "0x666666", "0x000000");
this.onData = function() {
if (this.output == "sent")
{ _root.status_txt.text = gotoAndStop ("100"); resetCampo(); } else { _root.status_txt.text = "Tutti i campi
sono obbligatori!"; }
// end else if }; } // end else if //}; resetCampo();invece nel file php chiamato output.php ho inserito:
codice PHP: <? if(!empty($HTTP_POST_VARS['php_nome']) || !empty($HTTP_POST_VARS['php_cognome']) || !empty($HTTP_POST_VARS['php_azienda'])
|| !empty($HTTP_POST_VARS['php_telefono']) || !empty($HTTP_POST_VARS['php_email'])
|| !empty($HTTP_POST_VARS['php_citta']))
{ //Inserire la propria mail nel parametro $to $to = "[email protected]"; $subject =
stripslashes("Hai ricevuto una mail da " . $HTTP_POST_VARS['php_nome']) .
$HTTP_POST_VARS['php_cognome']) . $HTTP_POST_VARS['php_azienda']); $body =
stripslashes($HTTP_POST_VARS['php_nome' . $HTTP_POST_VARS['php_cognome']) .
$HTTP_POST_VARS['php_azienda']) . $HTTP_POST_VARS['php_telefono']) .
$HTTP_POST_VARS['php_email']) . $HTTP_POST_VARS['php_citta']);
$body .= "\n\n---------------------------\n"; $body .= "Da: " .
$HTTP_POST_VARS['php_nome'] . " <" . $HTTP_POST_VARS['php_email'] . ">\n" .
$HTTP_POST_VARS['php_email']; $header = "From: " . $HTTP_POST_VARS['php_nome'] . " <"
. $HTTP_POST_VARS['php_email'] . ">\n" . $HTTP_POST_VARS['php_email']; $header .=
"Reply-To: " . $HTTP_POST_VARS['php_nome'] . " <" . $HTTP_POST_VARS['php_email'] .
">\n" . $HTTP_POST_VARS['php_email']; $header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1"; if(@mail($to, $subject, $body, $header))
{ echo "output=sent"; } else { echo "output=error"; } } else { echo "output=error"; } ?>Detto questo, volevo sapere come facevo a fare in modo che nella mail che mi dovrebbe arrivare, arrivino anche i dati delle check box...
Poi avrei altre domande... per esempio ho creato un campo di testo dinamico, chiamato status_txt, dove dovrebbe farmi vedere, quando il testo è stato inviato : "INVIATO", quando invece non vengono compilati tutti i campi dovrebbe vedersi: "Tutti i campi sono obbligatori!"
Ok ringrazio per la pazienza _