• User

    Problema con invio Form

    Ciao a tutti,
    ho bisogno di capire come mai non mi parte il modulo form che ho creato.

    Purtroppo non sono un esperto di php.....sono un grafico web e adv, conosco html, css, java ecc ....ma il php lo mastico poco. Sono "costretto" per lavoro di arrangiarmi anche in questo settore....me la cavicchio ma appunto mi inceppo su cose che magari per voi sono semplicissime.....

    Vi posto la pagina di validazione dove passano i dati:

    <?php
    $email=$_POST['email'];
    
    #######################################
    #     IMPOSTAZIONI DA CONFIGURARE     #
    #######################################
    
    //(1) indirizzo email del destinatario del modulo
    $destinatario = "[email protected]";
    
    //(2) indirizzo email del mittente, campo FROM
    //    non toccare se desiderate che l'indirizzo email inserito nel modulo sia
    //    riportato nel campo DA del messaggio che sarà ricevuto.
    //    Se invece desiderate un campo fisso annullare la prima riga e abilitare
    //    la seconda inserendo la dicitura desiderata (per annullare mettere //
    //    all'inizio della prima riga e per abilitare togliere // dalla seconda riga)
    $nome_mittente = "$email";
    // $nome_mittente = "Dal Modulo";
    
    //(3) oggetto del messaggio
    $oggetto_email = "oggetto";
    
    //(4) se si vogliono rendere tutti i campi NON OBBLIGATORI impostare su "y".
    //    (valori possibili: "y" e "n")
    $all_free = "n";
    
    //(5) se avete messo "n" al punto (4) inserire tra virgolette, separati
    //    da virgola, i nomi dei campi da rendere OBBLIGATORI
    //    Esempio: $campi_req = array("nome","telefono","via");
    $campi_req = array("name","surname","email","email2","country","tours_name","no_people","tour_date","tourPrice","pickup_location","agree");
    
    //(6) controllo validità del campo email. (valori possibili: "y" e "n")
    $obbligo_email = "y";
    
    //(7) obbligare l'utente ad accettare le condizioni.
    //    (valori possibili: "y" e "n")
    $accetta_condizioni = "n";
    
    //(8) URL della pagina di ringraziamento
    $pagina_grazie = "/thanks.htm";
    
    //(9) URL della pagina errore campi vuoti
    $pagina_error_empty = "/error.htm";
    
    //(10) URL della pagina errore email
    $pagina_error_email = "/error.htm";
    
    //(11) URL della pagina errore condizioni non accettate
    $pagina_error_condizioni = "/error.htm";
    
    //(12) URL della pagina errore invio non autorizzato (mancanza di referer)
    $pagina_error_referer = "/error.htm";
    
    #######################################
    #  FINE IMPOSTAZIONI DA CONFIGURARE   #
    #######################################
    
    //ora e data
    $ora = date ("H:i:s"); 
    $data = date ("d/m/Y");
    
    //intestazione email che arriva al destinatario
    $corpo = "
    Modulo inviato il $data alle ore $ora
    Riepilogo dati:\n\n";
    
    //============== NON TOCCARE NULLA OLTRE QUESTA RIGA ==================\
    
    
    ########### CODICI ###########
    
    //variabili per rendere lo script compatibile anche con la versione PHP 4.2 e maggiori
    if(!isset($_SERVER) OR !$_SERVER OR !is_array($_SERVER) OR count(array_diff($_SERVER, $HTTP_SERVER_VARS))){  
    $_POST = &$HTTP_POST_VARS; 
    }
    
    //prende IP ADDRESS
    if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
        
        if ($_SERVER["HTTP_X_FORWARDED_FOR"] == "") {
    
    $ipnumb = getenv("REMOTE_ADDR");
    
            }else {
    
    $ipnumb = getenv("HTTP_X_FORWARDED_FOR");
    
                }
    
            } else {
    
    $ipnumb = getenv("REMOTE_ADDR");
            }
    ###################################
    
    //controllo referer
    if(empty($_SERVER["HTTP_REFERER"])){
    
        header ("Location: $pagina_error_referer");
        exit();
        
        }
    
    ########### CONTROLLO DEI CAMPI ###########
    $control_campi = 0;
    
    if($all_free != "y"){
    
        foreach($_POST as $key => $valore){
    
            if(in_array($key,$campi_req)){
    
                if(trim($valore) == ""){
    
                $control_campi++;
                
                                        } 
    
                                    }
    
                                }
    
                            } else {
    
                $control_campi = 0;    
    
                                    }                    
    
    ########### CONTROLLO EMAIL ###########
    $control_email = 0;
    
    if($obbligo_email == "y"){
    
        if(isset($_POST['email'])){
    
            if(!eregi("^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9_-])+.)+[a-z]{2,6}$", $_POST['email'])){
    
            $control_email++;
    
                                }
    
                            } else {
    
            $control_email = 0;
    
                                }
    
                            }
    
    ########### CONTROLLO CONDIZIONI ###########
    $control_condizioni = 0;
    
    if($accetta_condizioni == "y"){
    
        if(isset($_POST['trattamento_dati']) && $_POST['trattamento_dati'] == "accetto"){
    
            $control_condizioni = 0;
    
                } else {
    
            $control_condizioni ++;
    
                }
    
            }
    
    ########### INVIO EMAIL ###########
    if($control_campi == 0){
    
            if($control_email == 0){
    
                if($control_condizioni == 0){
    
    foreach($_POST as $key => $valore){
    
    $key = ucfirst(stripslashes(trim($key)));
    $valore = stripslashes(trim($valore));
    $key = str_replace("_"," ",$key);
    
                if(trim($valore) == "") $valore = "Non compilato";
                
                    $corpo .= $key .": ". $valore ."\n\n";
    
                }
                
                    $corpo .= "Numero IP: $ipnumb"."\n";
    
    $corpo .= "____________________________________________________________ \n\n
    
    ";
    
        
    // invio e-mail
    // Header Mail
    $headmail.="From: $nome_mittente <$nome_mittente>\n";
    $headmail.="Return-Path: $nome_mittente\n";
    $headmail.="User-Agent: Php Mail Function\n";
    $headmail.="X-Accept-Language: en-us, en\n";
    $headmail.="MIME-Version: 1.0\n";
    $headmail.="X-Priority: 1 (Highest)\n";
    $headmail.="Content-Type: text/plain; charset=ISO-8859-1; format=flowed\n";
    $headmail.="Content-Transfer-Encoding: 7bit\n";
    
    ini_set('sendmail_from', "$destinatario");
    mail("$destinatario", "$oggetto_email", "$corpo", "$headmail");
    
                    header ("Location: $pagina_grazie");
    
                                    } else {
    
                    header ("Location: $pagina_error_condizioni");
    
                                }
    
                            } else {
    
                    header ("Location: $pagina_error_email");
    
                            }
    
                        } else {
    
                        
                    header ("Location: $pagina_error_empty");
    
                        }
    
    ?>
    

    la pagina in questione è la seguente: driverguideservice . com / tours / reservation_test.php

    Grazie in anticipo 🙂


  • ModSenior

    Ciao PI74image,
    puoi postare anche il form utilizzato?


  • User

    Eccolo qui:

    
    <form name="modulo" method="post" action="reservation-form_test.php">
                <div class="row_transfers">
                <label for="first_name" style="float:left;width:100%;">Name <strong>*</strong>:</label>
                <input name="first_name" type="text" id="first_name" size="64" />
                </div>
                
                <div class="row_transfers">
                <label for="last_name" style="float:left;width:100%;">Surname <strong>*</strong>:</label>
                <input name="last_name" type="text" id="last_name" size="64"  />
                </div>    
                                        
                <div class="row_transfers">
                <label for="email" style="float:left;width:100%;">Email <strong>*</strong>:</label>
                <input name="email" type="text" id="email" size="64" />
                </div>
    
                <div class="row_transfers">
                <label for="email2" style="float:left;width:100%;">Email Verify <strong>*</strong>:</label>
                <input name="email2" type="text" id="email2" size="64" />
                </div>
                
                <div class="row_transfers">
                <label for="country" style="float:left;width:100%;">Your Country of Residence <strong>*</strong>:</label>
                <input name="country" type="text" id="country" size="64" />
                </div>                       
    
                <div class="row_transfers">
                <label for="telephone" style="float:left;width:100%;">Phone number in Italy (if applicable):</label>
                <input name="telephone" type="text" id="telephone" size="64" />
                </div>                       
    
              <div class="row_transfers">
                <label for="luggage" style="float:left;width:150px;">Pieces of luggage:</label>
                <select name="luggage" id="select2" />
                    <option  value="0">None</option>
                    <option  value="1">1</option>
                    <option  value="2">2</option>
                    <option  value="3">3</option>
                    <option  value="4">4</option>
                    <option  value="5">5</option>
                    <option  value="6">6</option>
                    <option  value="7">7</option>
                    <option  value="8">8</option>
                    <option  value="9">9</option>
                    <option  value="10">10</option>
                    <option  value="11">11</option>
                    <option  value="12">12</option>
                    <option  value="13">13</option>
                    <option  value="14">14</option>
                    <option  value="15">15</option>
                </select>
                </div>                                          
    
                <h2>YOUR TOUR:</h2>
               
                <div style="background:url(../img/tourbg.png) repeat; padding:5px;">
                <div class="row_transfers">
                <label for="tours_name" style="float:left;width:100%;">Please select a Tour <strong>*</strong>:</label>
                <select class="" name="tours_name" id="tours_name" onchange="cruisecheck(this.value);">
                    
                  <optgroup label="CHOOSE A ROME CITY TOUR:" <="" optgroup="">
                  <option value="RomeCityTour-EnglishSpeakingDriver"> -- Rome City Tour w/English Speaking Driver</option>
                  <option value="RomeByNight"> -- Rome by Night</option>
                  <option value="TivoliGardens">-- Tivoli Gardens</option>
                  <option value="AncientOstia"> -- Ancient Ostia</option>
            
                  <option value="AncientRomeWalkingTour"> -- Ancient Rome Walking Tour</option>
                  <option value="FountainsSquaresWalkingTour"> -- Fountains &amp;  squares walking Tour</option>
                  <option value="RealRomeWalkingTour"> -- Real Rome walking Tour</option>
          
                 </optgroup><optgroup label="CHOOSE A CRUISE EXCURSION:" <="" optgroup="">
                 <option value="PortLivorno"> -- Port of Livorno(Florence)</option>
                 <option value="Civitavecchia"> -- Port of Civitavecchia(Rome)</option>
                 <option value="portNaples"> -- Port of Naples</option>
    
        </optgroup><optgroup label="CHOOSE A VATICAN TOUR:" <="" optgroup="">
          <option value="tourVatican"> -- Tour of the Vatican</option>
    
     </optgroup><optgroup label="CHOOSE A DAY TRIP FROM ROME:" <="" optgroup="">
          <option value="dayTripTuscanCountryside"> -- Tuscan Countryside</option>
          <option value="dayTripFlorence"> -- Florence</option>
          <option value="dayTripUmbria"> -- Umbria</option>
          <option value="dayTripPompeiiAmalfiCoast"> -- Pompeii &amp; Amalfi Coast</option>
          
          </optgroup><optgroup label="CHOOSE A WALKING TOUR OF ROME:" <="" optgroup="">
          <option value="walking_AncientRome"> -- Acient Rome</option>
          <option value="walking_FountainsSquares"> -- Fountains &amp; Squares</option>
          <option value="walking_REALrome"> -- REAL Rome</option>
          <option value="walking_BorgheseGallery"> -- Borghese Gallery</option>
    
        </optgroup></select>
                </div>
                
                <div class="row_transfers">
                <label for="no_people" style="float:left;width:200px;">Number of people in your tour <strong>*</strong>:</label>
                <select name="no_people" id="no_people">
                  <option  value="1">1</option>
                  <option  value="2">2</option>
                  <option  value="3">3</option>
                  <option  value="4">4</option>
                  <option  value="5">5</option>
                  <option  value="6">6</option>
                  <option  value="7">7</option>
                  <option  value="8">8</option>
                  <option  value="9">9</option>
                  <option  value="10">10</option>
                  <option  value="11">11</option>
                  <option  value="12">12</option>
                  <option  value="13">13</option>
                  <option  value="14">14</option>
                  <option  value="15">15</option>
                </select>
                </div>
                
                <div class="row_transfers" style="position:relative;">
                <label for="tour_date" style="float:left;width:200px;">Date of Tour <strong>*</strong>:</label>
                           
                <input type="text" name="tour_date" id="sel3" size="30"
    ><input type="reset" value=" ... "
    onclick="return showCalendar('sel3', '%d/%m/%Y');">
                          
                </div>
                
                <div class="row_transfers">
                <label for="tourPrice" style="float:left;width:200px;">Agreed price in EUROS <strong>*</strong>:</label>
                <input class="" name="tourPrice" id="tourPrice" size="7" maxlength="7" value="" type="text" />
                </div>
                
                <div class="row_transfers">
                <label for="pickup_location" style="float:left;width:160px;">You will be picked up at <strong>*</strong>:</label>
                <label><input name="pickup_location" id="pickup_location" value="Hotel" type="radio">Hotel</label>
                <label><input name="pickup_location" id="pickup_location" value="Ship" type="radio">Cruise Ship</label>
                <label><input name="pickup_location" id="pickup_location" value="Airport" type="radio">Airport</label>
                <label><input name="pickup_location" id="pickup_location" value="otherLocation" type="radio">Other Location</label>
                </div>
    
                <div id="location_hotel" style="display:none;">
                <div class="row_transfers">
                <label for="hotelName" style="float:left;width:150px;">Name and City Of Hotel:</label>
                <input name="hotelName" type="text" id="hotelName" size="20" maxlength="60" value=""/>
                </div>
                <div class="row_transfers">
                <label for="hotelPhone" style="float:left;width:150px;">Hotel Phone Number:</label>
                <input name="hotelPhone" type="text" id="hotelPhone" size="20" maxlength="20" value="" />
                </div>
                </div>
                
                <div id="location_ship" style="display:none;">
                <div class="row_transfers">
                <label for="shipName" style="float:left;width:150px;">Name of Cruise Ship:</label>
                <input name="shipName" type="text" id="shipName" size="20" maxlength="60" value=""/>
                </div>
                <div class="row_transfers">
                <label for="portName" style="float:left;width:150px;">Name of Port in Italy:</label>
                <input name="portName" type="text" id="portName" size="20" maxlength="60" value=""/>
                </div>
                </div>
                
                <div id="location_airplane" style="display:none;">
                <div class="row_transfers">
                <label for="arrivalTime" style="float:left;width:150px;">Flight Arrival Time:</label>
                <input name="arrivalTime" type="text" id="arrivalTime" size="20" maxlength="10" value=""/>
                </div>
                <div class="row_transfers">
                <label for="departureTime" style="float:left;width:150px;">Flight Departure Time:</label>
                <input name="departureTime" type="text" id="departureTime" size="20" maxlength="10" value=""/>
                </div>
                <div class="row_transfers">
                <label for="airportNameCity" style="float:left;width:150px;">Airport Name and City:</label>
                <input name="airportNameCity" type="text" id="airportNameCity" size="20" maxlength="60" value=""/>
                </div>
                <div class="row_transfers">
                <label for="airportFlightNumber" style="float:left;width:150px;">Airline and Flight Number:</label>
                <input name="airportFlightNumber" type="text" id="airportFlightNumber" size="20" maxlength="8" value=""/>
                </div>
                </div>
                
                <div id="location_other" style="display:none;">
                <div class="row_transfers">
                <label for="arrivalTimeOther" style="float:left;width:150px;">Pickup Time:</label>
                <input name="arrivalTimeOther" type="text" id="arrivalTimeOther" size="20" maxlength="10" value=""/>
                </div>
                <div class="row_transfers">
                <label for="arrivalAddressOther" style="float:left;width:100%;">Address/location of pick up (please use full address and any notes to help):</label>
                <textarea name="arrivalAddressOther" cols="60" rows="4" id="arrivalAddressOther"></textarea>
                </div>
                </div>
                        
                </div>
    
                <div style=" margin:20px 0; overflow:auto; height:200px;">
                    <h4>Food and drink</h4>
                    <p>It is not permitted to enter the Museums with alcoholic drinks. It is obligatory to leave alcoholic drink in the cloakroom before entering the Museums, these drinks must then be collected, on the same day, at the end of the visit. Visitors are allowed to leave food and drink in the cloakroom, on the condition that this is collected before closing hours. Uncollected food and drink will be destroyed at the end of the day.</p>
    <h4>Bags, backpacks, umbrellas</h4>
    <p>The cloakroom staff will accept from the visitors their bags and personal belongings (irrispective of the form, material or dimension of th object), with the exception of clothing items, hats, portable umbrellas.</p>
        <ul>
            <li><strong>It is obligatory to deposit in the cloakroom</strong> suitcases, backpacks and containers with dimensions larger than cm 40 x 35 x 15.</li>
            <li><strong>It is obligatory to deposit in the cloakroom</strong> bags and bagpacks which are cumbersome, except those small-sized, that carried on shoulder, don't jut out by 15 cm from the body's shape in its highest point.</li>
            <li><strong>It is obligatory to deposit in the cloakroom</strong> any umbrella with a spike tip, umbrellas of medium and large size, walking sticks (except those required by disabled visitors to facilitate their movement), tripods for cameras and video cameras, signage of any kind (except signs used by official guides for their identification).</li>
            <li><strong>It is obligatory to deposit in the cloakroom</strong> knives, scissors, any tools thai could be harmful to other persons ora damage works of art in the Museums.</li>
            <li><strong>It is not possible to deposit in the cloakroom</strong>, fiirearms of any kind or other dangerous objects. It is strictly forbidden to enter the Museums with any kind of weapon.</li>
        </ul>
        <p>Access to the Museums by armed visitors is not permitted. Non exception to this rule is made for visitors holding a firearm permit, or if the weapon forms part of a uniform (police, military or others).</p>
        <h4>Museum surveillance</h4>
        <p><strong><u>It is forbidden to touch works of art.</u></strong> The works of the Vatican Museums are subject to a costant television monitoring by the surveillance of the Museums and by an electronic alarm system.</p>
        <h4>Microphones</h4>
        <p>The use of microphones with amplifier is forbidden.</p>
        <h4>Required clothing</h4>
        <p><strong><u>Access to Vatican Museums, Sistine Chapel, Vatican Gardens and Saint Peter's Basilica is permitted only to visitors dressed appropriately.</u></strong></p>
        <h4>Photography</h4>
        <p>Works of art and surroundings may be photographed. Permission must be given by the Management of the Museum for the use of tripods and other professional equipment. It is <strong><u>forbidden</u></strong> to use <strong><u>flashlight</u></strong> photography inside the Museums.<br />
          <strong><u>No photography or filming is permitted in the Sistine Chapel. The surveillance is authorized to collect any kind of photography made inside the Sistine Chapel.</u></strong></p>
    <h4>Drawing permission</h4>
    <p>Permission must be sought from the Management of the Museums in order to make pencil drawings and sketches in the Museums. <strong><u>The use of laser pointers is forbidden.</u></strong></p>
    <h4>Mobile phones</h4>
    <p>The use of mobile phones is allowed, except in the Sistine Chapel. Anyway it is not recommended in order to guarantee the visitors a better fruiton of the works of art.</p>
    <h4>Pushchairs</h4>
    <p>Pushchairs are permitted in the Museums.</p>
                </div>
                
                <div class="row_transfers">
                <input name="agree" id="agree" value="" type="checkbox"> <strong>I Agree to the terms of this tour*</strong>
                </div>
        
        <input name="finalSubmit" id="finalSubmit" value="SUBMIT YOUR ORDER WITH EASITALYTOURS" onClick="return sendevent('process','index.php','validate_form');" type="button">
                
            </form>
    
    

  • User

    Se ti serve altro fammi sapere.

    Grazie 🙂