Menu

Probleme formulaire avec session_start sur plusieurs page

hans92000 1 Messages postés lundi 29 janvier 2018Date d'inscription 29 janvier 2018 Dernière intervention - 29 janv. 2018 à 15:45 - Dernière réponse : legameur6810 49 Messages postés mardi 21 novembre 2017Date d'inscription 14 avril 2018 Dernière intervention
- 11 févr. 2018 à 21:02
Bonjour à tous !

Voilà j'ai créé un formulaire un peu "special" etant donné qu'il est divisé en 3 formulaires (transfert / journée / séjour) et qu'il est sur plusieurs pages (j'utilise session_start pour cela).

Jusque maintenant tout marchait très bien mais depuis 2 jours... je n'arrives pas à recevoir les demandes sur la boite de destination...

La structure du formulaire :

PAGE 1 : Choix du formulaire et détails sur le voyage

PAGE 2 : Données personnelles

PAGE : Confirmation d'envoi du devis

Voilà le code :

PAGE 1 :

<?php
session_start(); // Session starts here.
?>

<div id="form-header" class="tabs-3">
<div class="container">
<div class="row">
<div class="col-md-8 " id="tabs-slide-left-2">

<p class="text-center title-form txt-light txt-25 title-os">Mon Voyage</p>
<ul class="nav nav-tabs nav-justified">
<li><a href="#tabs-des-1" title="">Transfert</a></li>
<li><a href="#tabs-des-2" title="">Journée</a></li>
<li><a href="#tabs-des-3" title="">Séjour</a></li>
</ul>

<div id="tabs_container">
<div id="tabs-des-1">
<br/><table id="table-form">
<form method="post" action="transfert_devis.php">
<tr>
<td colspan="3"><input onClick="verif();" type="radio" name="radio-2" id="radio-5" class="inp-20">
<label class="txt-light title-sa fw-600" for="radio-5"> Transfert simple</label>    
<input onClick="verif2();" type="radio" name="radio-2" id="radio-6" class="inp-20">
<label class="txt-light title-sa fw-600" for="radio-6"> Transfert A/R</label></td>

</tr>
<tr>
<td class="text-center icone-form"><i class="txt-20 txt-light fa fa-calendar" aria-hidden="true"></i></td>
<td><input type="date" name="date1" id="date1" class=" title-sa txt-blue inp-150 calendar-input on" placeholder="Date Départ"></td>
<td><input type="date" name="date2" id="date2" class=" title-sa txt-blue inp-150 calendar-input on" placeholder="Date Retour"></td>
</tr>
<tr>
<td class="text-center icone-form"><i class="txt-25 txt-light fa fa-map-marker" aria-hidden="true"></i></td>
<td colspan="2"><input id="city1" name="city1" class="title-sa txt-blue inp-340" placeholder="De : Adresse ou Ville"></td>
</tr>
<td class="text-center icone-form"><i class="txt-25 txt-light fa fa-map-marker" aria-hidden="true"></i></td>
<td colspan="2"><input type="text" name="city2" id="city2" class=" title-sa txt-blue inp-340" placeholder="À : Adresse ou Ville"></td>

<tr>
<td class="text-center icone-form"><i class="txt-20 txt-light fa fa-users" aria-hidden="true"></i></td>
<td colspan="2"><label for="pax" class="txt-light title-sa fw-600">N° de passagers</label>   <input type="text" name="pax" id="pax" class="txt-blue inp-60"></td>
</tr>
<tr>
<td class="text-center icone-form"><i class="txt-20 txt-light fa fa-bus" aria-hidden="true"></i></td>
<td colspan="2"><label for="veh" class="txt-light title-sa fw-600">Type de Véhicule</label>   <select name="veh" id="veh">
<option class="txt-blue title-sa">Minibus 8 places</option>
<option class="txt-blue title-sa">Minibus 16 places</option>
<option class="txt-blue title-sa">Autocar 49 places</option>
<option class="txt-blue title-sa">Autocar 53 places</option>
<option class="txt-blue title-sa">Autocar 56 places</option>
<option class="txt-blue title-sa">Autocar 62 places</option>
<option class="txt-blue title-sa">Autocar 68 places</option>
<option class="txt-blue title-sa">Autocar 78 places</option>
</select></td>
</tr>
<tr>
<td colspan="3"><button type="submit" name="submit" class="btn btn-m btn-form" >Envoyer</button></td>
</tr>
</form>
</table><br/>
</div>

<div id="tabs-des-2">
<br/><table id="table-form">
<form method="post" action="journee_devis.php">
<tr>
<td class="icone-form"><i class="txt-20 txt-light fa fa-calendar" aria-hidden="true"></i></td>
<td colspan="2"><input type="date" name="date1_dt" id="date1_dt" class="title-sa txt-blue inp-150 calendar-input" placeholder="Date Départ"></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-20 txt-light fa fa-clock-o" aria-hidden="true"></i></td>
<td colspan="2"><input type="text" name="hour1_dt" id="hour1_dt" class="title-sa txt-blue inp-100 calendar-input" placeholder="Heure Départ">  
<input type="text" name="hour2_dt" id="hour2_dt" class="title-sa txt-blue inp-100 calendar-input" placeholder="Heure Arrivée"></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-25 txt-light fa fa-map-marker" aria-hidden="true"></i></td>
<td colspan="2"><input id="city1_dt" name="city1_dt" class=" title-sa txt-blue inp-340" placeholder="De : Adresse ou Ville"></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-25 txt-light fa fa-location-arrow" aria-hidden="true"></i></td>
<td colspan="2"><input type="text" name="visit_dt" id="visit_dt" class=" title-sa txt-blue inp-340" placeholder="Lieu de Visite : Monument, Adresse, Ville..."></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-20 txt-light fa fa-users" aria-hidden="true"></i></td>
<td colspan="2"><label for="pax" class="txt-light title-sa fw-600">N° de Passagers</label>   <input type="text" name="pax_dt" id="pax_dt" class="txt-blue inp-60"></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-20 txt-light fa fa-bus" aria-hidden="true"></i></td>
<td colspan="2"><label for="veh" class="txt-light title-sa fw-600">Type de Véhicule</label>   <select name="veh_dt" id="veh_dt">
<option class="txt-blue title-sa">Minibus 8 places</option>
<option class="txt-blue title-sa">Minibus 16 places</option>
<option class="txt-blue title-sa">Autocar 49 places</option>
<option class="txt-blue title-sa">Autocar 53 places</option>
<option class="txt-blue title-sa">Autocar 56 places</option>
<option class="txt-blue title-sa">Autocar 62 places</option>
<option class="txt-blue title-sa">Autocar 68 places</option>
<option class="txt-blue title-sa">Autocar 78 places</option>
</select></td>
</tr>
<tr>
<td colspan="3"><button type="submit" name="submit" class="btn btn-m btn-form" >Envoyer</button></td>
</tr>
</form>
</table><br/>
</div>

<div id="tabs-des-3">
<br/><table id="table-form">
<form method="post" action="sejour_devis.php">
<tr>
<td class="icone-form"><i class="txt-20 txt-light fa fa-calendar" aria-hidden="true"></i></td>
<td><input type="date" name="date1_ld" id="date1_ld" class=" title-sa txt-blue inp-150 calendar-input on" placeholder="Date Départ"></td>
<td><input type="date" name="date2_ld" id="date2_ld" class=" title-sa txt-blue inp-150 calendar-input on" placeholder="Date Retour"></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-25 txt-light fa fa-map-marker" aria-hidden="true"></i></td>
<td colspan="2"><input id="city1_ld" name="city1_ld" class=" title-sa txt-blue inp-340" placeholder="De : Adresse ou Ville"></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-25 txt-light fa fa-location-arrow" aria-hidden="true"></i></td>
<td colspan="2"><input type="text" name="visit_ld" id="visit_ld" class=" title-sa txt-blue inp-340" placeholder="Lieu de Visite : Lieux ou Villes.."></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-20 txt-light fa fa-users" aria-hidden="true"></i></td>
<td colspan="2"><label for="pax" class="txt-light title-sa fw-600">N° de Passagers</label>   <input type="text" name="pax_ld" id="pax_ld" class="txt-blue inp-60"></td>
</tr>
<tr>
<td class="icone-form"><i class="txt-20 txt-light fa fa-bus" aria-hidden="true"></i></td>
<td colspan="2"><label for="veh" class="txt-light title-sa fw-600">Type de Véhicule</label>   <select name="veh_ld" id="veh_ld">
<option class="txt-blue title-sa">Minibus 8 places</option>
<option class="txt-blue title-sa">Minibus 16 places</option>
<option class="txt-blue title-sa">Autocar 49 places</option>
<option class="txt-blue title-sa">Autocar 53 places</option>
<option class="txt-blue title-sa">Autocar 56 places</option>
<option class="txt-blue title-sa">Autocar 62 places</option>
<option class="txt-blue title-sa">Autocar 68 places</option>
<option class="txt-blue title-sa">Autocar 78 places</option>
</select></td>
</tr>
<tr>
<td colspan="3"><button type="submit" name="submit" class="btn btn-m btn-form" >Envoyer</button></td>
</tr>
</form>
</table><br/>
</div>

</div>
</div>
</div>
</div>
</div>


PAGE 2 : ( sur la base où on a choisi le 1er des formulaires qui dirige sur transfert_devis.php )

<?php
session_start(); // Session starts here.
?>

<section>
<div class="container">
<div class="row">
<form class="contact-form-2" method="post" action="transfert_devis_confirmation.php" data-toggle="validator">
<div class="col-sm-10 col-sm-offset-1">
<div class="messages"></div>
</div>
<div class="controls">
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group">
<label class="control-label txt-blue">Votre Nom *</label>
<input type="text" name="name" class="form-control txt-blue" required="required" data-error="Name is required!">
</div>
<div class="form-group">
<label class="control-label txt-blue">Société</label>
<input type="text" name="company" class="form-control txt-blue">
</div>
<div class="form-group">
<label class="control-label txt-blue">Email *</label>
<input type="email" name="email" class="form-control txt-blue" required="required" data-error="Valid email is required!">
</div>
<div class="form-group">
<label class="control-label txt-blue">Téléphone</label>
<input type="phone" name="phone" class="form-control txt-blue">
</div>
</div>
<div class="col-sm-5">
<div class="form-group">
<label class="control-label txt-blue">Avez-vous plus de détails concernant votre voyage ?</label>
<textarea name="trip_detail" class="form-control txt-blue"></textarea>
</div>
</div>
<div class="col-sm-10 col-sm-offset-1">
<div class="form-group">
<button type="submit" name="submit" class="btn btn-m btn-blue margin-t-25" >
Envoyer votre demande
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</section>

<section class="pad-t-50 pad-b-50 pad-section-50">
<div class="pad-section-50">
<div class="container">
<div class="row border-v">
<div class="col-md-8 col-sm-6 text-right pad-r-50">
<?php

$_SESSION['date1'] = $_POST['date1'];
$_SESSION['date2'] = $_POST['date2'];
$_SESSION['city1'] = $_POST['city1'];
$_SESSION['city2'] = $_POST['city2'];
$_SESSION['pax'] = $_POST['pax'];
$_SESSION['veh'] = $_POST['veh'];
?>
<ul class="txt-justify txt-15 ul_base">
<li class="txt-25 fw-600 txt-blue">Mon Voyage :</li>
<li>Date de départ : <?php echo $_SESSION['date1'] ?></li>
<li>Lieu de prise en charge : <?php echo $_SESSION['city1'] ?></li>
<li>Lieu de dépose : <?php echo $_SESSION['city2'] ?></li>
<li>Date de retour (optionnel) : <?php echo $_SESSION['date2'] ?></li>
<li>Nombre de passager : <?php echo $_SESSION['pax'] ?></li>
<li>Type de véhicule : <?php echo $_SESSION['veh'] ?></li>
</ul>
</div>
<div class="col-md-4 col-sm-6 pad-l-50 text-left title-sa fw-300">
<p class="txt-13 pad-t-20 txt-blue fw-600">email: contact@europebusreservation.com
</p>
<p class="tit-section-2 txt-50 pad-b-30 txt-orange2">Besoin
<span class="txt-blue">D'Assistance ?</span>
</p>
</div>
</div>
</div>
</div>
</section>




PAGE 3 :

<?php
session_start(); // Session starts here.
$date1 = $_SESSION['date1'];
$date2 = $_SESSION['date2'];
$city1 = $_SESSION['city1'];
$city2 = $_SESSION['city2'];
$pax = $_SESSION['pax'];
$veh = $_SESSION['veh'];
?>

<section>
<div class="container">
<div class="row">
<?php

$_SESSION['company'] = $_POST['company'];
$_SESSION['name'] = $_POST['name'];
$_SESSION['email'] = $_POST['email'];
$_SESSION['phone'] = $_POST['phone'];
$_SESSION['trip_detail'] = $_POST['trip_detail'];
$provenance=$_SERVER['HTTP_REFERER'];

if (!empty($_SESSION['name']) && !empty($_POST['email'])){
$name=htmlspecialchars($_SESSION['name']);
$company=htmlspecialchars($_SESSION['company']);
$mail=htmlspecialchars($_SESSION['email']);
$phone=htmlspecialchars($_SESSION['phone']);
$trip_detail=htmlspecialchars($_SESSION['trip_detail']);
$date1=htmlspecialchars($date1);
$date2=htmlspecialchars($date2);
$city1=htmlspecialchars($city1);
$city2=htmlspecialchars($city2);
$pax=htmlspecialchars($pax);
$veh=htmlspecialchars($veh);
mb_strlen('è', 'UTF-8');
mb_strlen('é', 'UTF-8');
mb_strlen('ë', 'UTF-8');
mb_strlen('ê', 'UTF-8');
mb_strlen('à', 'UTF-8');
mb_strlen('â', 'UTF-8');
mb_strlen('î', 'UTF-8');
mb_strlen('ï', 'UTF-8');
mb_strlen('ô', 'UTF-8');
mb_strlen('ù', 'UTF-8');
mb_strlen('û', 'UTF-8');
mb_strlen('ç', 'UTF-8');
mb_strlen('È', 'UTF-8');
mb_strlen('É', 'UTF-8');
mb_strlen('Ë', 'UTF-8');
mb_strlen('Ê', 'UTF-8');
mb_strlen('À', 'UTF-8');
mb_strlen('Â', 'UTF-8');
mb_strlen('Î', 'UTF-8');
mb_strlen('Ï', 'UTF-8');
mb_strlen('Ô', 'UTF-8');
mb_strlen('Ù', 'UTF-8');
mb_strlen('Û', 'UTF-8');
mb_strlen('Ç', 'UTF-8');
$destinataire="contact@europebusreservation.com";
$titre="Transfer Quote Request";
$headers = "Content-Type: text/html; charset=UTF-8\n";
$message="Transfer Quote request from Website :<br/><br/>
Name : $name <br/>
Company : $company <br/>
Email : $mail <br/>
Phone : $phone <br/>
Date departure : $date1 <br/>
Address pick-up : $city1 <br/>
Address drop-off : $city2 <br/>
Date return : $date2 <br/>
Number of passengers : $pax <br/>
Vehicle type : $veh <br/>
Trip detail : $trip_detail";
ini_set( 'SMTP', 'mail.europebusreservation.com' );
mail($destinataire,$titre,$message,$headers);
echo " <p class=\". text-center txt-blue txt-15 fw-600\">Votre demande a bien été envoyée à notre équipe*</p>
<p class=\". text-center txt-blue txt-15 fw-500\">*En cas d'erreur :<br/>Merci de cliquer<a href=\"location-autocar-minibus-chauffeur-europe-uk.html\"> ici</a>.
</p>";
}
else{
echo "<p class=\". text-center txt-blue txt-15 fw-600\">Votre demande n'a pu être envoyée</p>
<p class=\". text-center txt-blue txt-15 fw-600\">*Instruction :<br/>Merci de cliquer<a href=\"location-autocar-minibus-chauffeur-europe-uk.html\"> ici </a>afin de réessayer.
</p>";
}

?>
</div>
</div>
</section>

<section class="pad-t-50 pad-b-50 pad-section-50">
<div class="pad-section-50">
<div class="container">
<div class="row border-v">
<div class="col-md-8 col-sm-6 text-right pad-r-50">
<ul class="txt-justify txt-15 ul_base">
<li class="txt-25 fw-600 txt-blue">Mon Voyage :</li>
<li>Date de départ : <?php echo $_SESSION['date1'] ?></li>
<li>Lieu de prise en charge : <?php echo $_SESSION['city1'] ?></li>
<li>Lieu de dépose : <?php echo $_SESSION['city2'] ?></li>
<li>Date de retour (optionnel) : <?php echo $_SESSION['date2'] ?></li>
<li>Nombre de pax : <?php echo $_SESSION['pax'] ?></li>
<li>Type de véhicule : <?php echo $_SESSION['veh'] ?></li>
<li>Détail du voyage : <?php echo $_SESSION['trip_detail'] ?></li>
</ul>
</div>
<div class="col-md-4 col-sm-6 pad-l-50 text-left title-sa fw-300">
<p class="txt-13 pad-t-20 txt-blue fw-600">email: contact@europebusreservation.com
</p>
<p class="tit-section-2 txt-50 pad-b-30 txt-orange2">Besoin
<span class="txt-blue">D'Assistance ?</span>
</p>
</div>
</div>
</div>
</div>
</section>

MERCI POUR VOTRE AIDE !!!

Afficher la suite 

Votre réponse

1 réponse

legameur6810 49 Messages postés mardi 21 novembre 2017Date d'inscription 14 avril 2018 Dernière intervention - 11 févr. 2018 à 21:02
0
Merci
Il te faudra un peu de js et beaucoups plus de php et je n'ai pas trop compris ton problème.

Configuration: Linux / Chrome 64.0.3282.119
Commenter la réponse de legameur6810