Visualizzazione dei risultati da 1 a 8 su 8
  1. #1

    checkbox - valore da inviare via mail

    Ciao a tutti!!!

    Nonostante mi ritenessi esperta di html, sono incappata, ahimè, in un problema banale!!!

    Ho un form, da inviare via email, nel quale ci sono una serie di checkbox dove scegliere delle date.. Il problema è che, quando invio il form via mail, mi prende solo il valore dell'ultima checkbox selezionata, e non di tutte. Che devo fare???

    form.php
    Codice PHP:
    ...
    <
    tr>
                        <
    td height="18"><span class="descrText">
                          <
    input type="checkbox" name="tour" id="tour" style="margin:0px;" value="West Wine Tour - 15/04/2007" />
                          
    15/04/2007</span> </td>
                        <
    td height="18"><span class="descrText">
                          <
    input type="checkbox" name="tour" id="tour" style="margin:0px;" value="Central Wine Tour - 27/05/2007" />
                          
    27/05/2007</span> </td>
                        <
    td height="18"><span class="descrText">
                          <
    input type="checkbox" name="tour" id="tour" style="margin:0px;" value="East Wine Tour - 22/04/2007" />
                          
    22/04/2007</span> </td>
                      </
    tr>
    ... 
    invia.php
    Codice PHP:

    if (isset($_POST['tour']) && !$_POST['tour']=='') {
              
              
    $tour addslashes(stripslashes(trim($_POST['tour'])));
              
    $tour str_replace("<""&lt;"$tour);
    }

    $email_destinatario "info@xxxxxx.it";
              
    $oggetto "Reservation from xxxxxxx.com";
              
    $corpo "Reservation from xxxxxxxx.com\n\nTitle/salutation: ".$title."\nFirst Name: ".$first_name."\nLast Name: ".$last_name."\nAddress: ".$address."\nCountry: ".$country."\nZip Code: ".$zip."\nTelephone: ".$phone."\nMobile: ".$mobile."\nEmail: ".$email."\n\nNotes:\n".$notes."\n\nTour: ".$tour."\n\n";

    if (
    mail ($email_destinatario$oggetto$corpo"From: $email")) {
    echo 
    "

    Your reservation has been sent. You'll be contact as soon as possible. 
    Thanks for your interest.</p>

    <a href=\"reservation.html\">Back to the form</a></p>"
    ;
    } else {
    echo 
    "

    Sorry. An error occured while sending your reservation. 
    Please try again!</p>

    <a href=\"reservation.html\">Back to the form</a></p>"
    ;

    nell'email che ricevo vedo solo l'ultima scelta effettuata... dove sbaglio?? grazie mille!!!

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2001
    Messaggi
    202
    beh le checkbox le devi fare univoche...

    tourA tourB tourC e poi le gestisci
    Oppure usa un array

  3. #3
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    metti il nome così:

    codice:
    <input type="checkbox" name="tuacheckbox[]" .../>
    Per ogni checkbox appartenente allo stesso "gruppo" di checkboxes. Poi nell'array $_POST, $_POST['tuacheckbox'] sarà l'array contenente le (e solo quelle) checkbox spuntate.
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  4. #4
    sììììììììììììììììììììììì funzionaaaaaaaaaaaaa

    grazie a tutti, ma soprattutto ad andrea, che è il mio guru personale!!!!!!!!!!!!!!



  5. #5
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    Originariamente inviato da elysaweb
    sììììììììììììììììììììììì funzionaaaaaaaaaaaaa

    grazie a tutti, ma soprattutto ad andrea, che è il mio guru personale!!!!!!!!!!!!!!


    Avanzo una birra.
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  6. #6
    come sei materiale.... non ti bastano la mia stima e la mia riconoscenza????!!!

  7. #7
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    no.
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  8. #8

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.