Bonjour, j'aimerai afficher 3 formulaire dynamiquement dans joomla avec "sourcerer" ( j'ai commencé mais mon script plante et localement ça marche très bien mes formulaire s'affichent dynamiquement chaque fois que j'appuis sur submit sauf en ligne ) le code fichier local : "Formulaire2Refait.php" :
website joomla : http://teste-websites.be/index.php/fr/reservation
http://teste-websites.be/Formulaire2Refait.php
Fichier "envois_formulaire.php" :
Merci !
Modifié par webmaster83 (14 Aug 2018 - 11:59)
website joomla : http://teste-websites.be/index.php/fr/reservation
http://teste-websites.be/Formulaire2Refait.php
<body>
<?php /* premiere partie s'affiche calcule tarif fonctionne */
if ( !isset( $_POST[ 'adresse1' ] ) && !isset( $_POST[ 'adresse2' ] ) && !isset( $_POST[ 'prix' ] ) ) {
?>
<form action='Formulaire2Refait.php#anchor' method='post' accept-charset="UTF-8">
Rue et numéro
<input type='text' name='adresse1' size='auto'/><br> Code postal <input type='text' name='codepostal1' size='auto'/> <br>Pays
<select name='pays1' size='auto'>
<option value="Belgique" selected>Belgique</option>
<option value="France">France</option>
<option value="Nederland">Pays-Bas</option>
<option value="Deutschland">Allemagne</option>
</select><br>
Rue et numero
<input type='text' name='adresse2' size='auto'/><br> Code postal <input type='text' name='codepostal2' size='auto'/> <br>Pays
<select name='pays2' size='auto'>
<option value="Belgique" selected>Belgique</option>
<option value="France">France</option>
<option value="Nederland">Pays-Bas</option>
<option value="Deutschland">Allemagne</option>
</select><br>
Nombre de passagers
<select class="" style="" id="heure" name="passagers" style="margin-left:10px;">
<option value="1-4"> 1 à 4 </option>
<option value="4-8"> 5 à 8 </option>
</select><br>
Type de voyage
<select class="" style="" id="heure" name="double" style="margin-left:10px;">
<option value="Aller simple"> Aller simple</option>
<option value="Aller-retour"> Aller-retour </option>
</select><br>
<input type='submit' value='Calculer le tarif' name='calculate' class="btn2"/>
</form>
<?php } ?>
<!-- Deuxième partie-->
<?php
if ( isset( $_POST[ 'adresse1' ] ) && isset( $_POST[ 'adresse2' ] ) ) {
// Lancement de la fonction
$adresse1 = $_POST[ 'adresse1' ] . ' ' . $_POST[ 'codepostal1' ] . ' ' . $_POST[ 'pays1' ];
$adresse2 = $_POST[ 'adresse2' ] . ' ' . $_POST[ 'codepostal2' ] . ' ' . $_POST[ 'pays2' ];
$adresse1 = str_replace( " ", "+", $adresse1 );
$adresse2 = str_replace( " ", "+", $adresse2 );
$codepostal1 = $_POST[ 'codepostal1' ];
$codepostal2 = $_POST[ 'codepostal2' ];
$pays1 = $_POST[ 'pays1' ];
$pays2 = $_POST[ 'pays2' ];
$date = $_POST[ 'date' ];
$billetretour = $_POST[ 'billetretour' ];
$billetaller = $_POST[ 'billetaller' ];
$billetdepart = $_POST[ 'billetdepart' ];
$double = $_POST[ 'double' ];
$passagers = $_POST[ 'passagers' ];
function getDistance( $adresse1, $adresse2 ) {
$url = 'http://maps.google.com/maps/api/directions/xml?language=fr&origin=' . $adresse1 . '&destination=' . $adresse2 . '&sensor=false';
$xml = file_get_contents( $url );
$root = simplexml_load_string( $xml );
$distance = $root->route->leg->distance->value;
$duree = $root->route->leg->duration->value;
$etapes = $root->route->leg->step;
return array(
'distanceEnMetres' => $distance,
'dureeEnSecondes' => $duree,
'etapes' => $etapes,
'adresseDepart' => $root->route->leg->start_address,
'adresseArrivee' => $root->route->leg->end_address
);
}
$func = getDistance( $adresse1, $adresse2 );
$distance = $func[ 'distanceEnMetres' ];
$depart = $func[ 'adresseDepart' ];
$arrivee = $func[ 'adresseArrivee' ];
$duree = $func[ 'dureeEnSecondes' ];
$dureetrajet = ( $duree / 60 );
$distanceenkm = ( $distance / 1000 );
if ( $distanceenkm >= 40 ) {
$prix = ( $distanceenkm * 1.25 );
}
if ( $distanceenkm < 40 ) {
$prix = ( $distanceenkm * 1.80 );
}
$aeroport = array( 'Brussels Airport', 'Zaventem', 'Brussels South', 'Charleroi Airport' );
$codepostalcharleroi = range( 6000, 6599 );
$codepostalbruxelles = range( 1000, 1299 );
$codepostalreduc25 = array( '1030', '1130', '1140', '1410', '1820', '1800', '1933', '1970' );
$codepostalperiph = array( '1150', '1200', '1210', '1950', '1800', '1830', '1850', '1860', '1880', '1860', '1910' );
if ( strpos( $depart, 'Zaventem' ) !== false || strpos( $arrivee, 'Zaventem' ) !== false ) {
if ( $distanceenkm <= 15 ) {
$prix = 30;
}
}
// FROM BRUSSELS TO ZAVENTEM 30€ or 34€
if ( strpos( $arrivee, 'Zaventem' ) !== false ) {
// REDUC FROM Woluwe/Schaerbeek TO ZAVENTEM 30€
if ( strpos( $depart, 'Woluwé' ) ||
strpos( $depart, 'Woluwe' ) ||
strpos( $depart, 'Kraainem' ) ||
strpos( $depart, 'Schaerbeek' ) ||
strpos( $depart, 'Evere' ) ||
strpos( $depart, 'Saint-Josse-ten-Noode' ) ||
strpos( $depart, 'Sterrebeek' ) ||
strpos( $depart, 'Sint-Stevens-Woluwe' ) ||
strpos( $depart, 'kapelle-op-den-bos' ) ||
strpos( $depart, 'Ramsdonk' ) ||
strpos( $depart, 'Berg' ) ||
strpos( $depart, 'Ramsdonk' ) ||
strpos( $depart, 'Kampenhout' ) ||
strpos( $depart, 'Machelen' ) ||
strpos( $depart, 'Woluwe-Saint-Pierre' ) ||
strpos( $depart, 'Woluwe-Saint-Lambert' ) ||
strpos( $depart, 'Saint-Josse-ten-Noode' ) ||
strpos( $depart, 'Nossegem-Sterrebeek' ) ||
strpos( $depart, 'Vilvoorde' ) ||
strpos( $depart, 'Grimbergen' ) ||
strpos( $depart, 'Wezembeek-Oppem' ) ) {
$prix = 30;
}
// FROM ELSEWHERE IN BRUSSELS TO ZAVENTEM 34€
else if ( in_array( $codepostal1, $codepostalbruxelles ) ) {
echo "Bruxelles - Zaventem OK";
$prix = 30;
}
}
// FROM ZAVENTEM TO BRUSSELS 30€ or 34€
if ( strpos( $depart, 'Zaventem' ) !== false ) {
// FROM ZAVENTEM TO Woluwe/Schaerbeek 30€
if ( strpos( $depart, 'Woluwé' ) ||
strpos( $depart, 'Woluwe' ) ||
strpos( $depart, 'Kraainem' ) ||
strpos( $depart, 'Schaerbeek' ) ||
strpos( $depart, 'Evere' ) ||
strpos( $depart, 'Saint-Josse-ten-Noode' ) ||
strpos( $depart, 'Sterrebeek' ) ||
strpos( $depart, 'Sint-Stevens-Woluwe' ) ||
strpos( $depart, 'kapelle-op-den-bos' ) ||
strpos( $depart, 'Ramsdonk' ) ||
strpos( $depart, 'Berg' ) ||
strpos( $depart, 'Ramsdonk' ) ||
strpos( $depart, 'Kampenhout' ) ||
strpos( $depart, 'Machelen' ) ||
strpos( $depart, 'Woluwe-Saint-Pierre' ) ||
strpos( $depart, 'Woluwe-Saint-Lambert' ) ||
strpos( $depart, 'Saint-Josse-ten-Noode' ) ||
strpos( $depart, 'Nossegem-Sterrebeek' ) ||
strpos( $depart, 'Vilvoorde' ) ||
strpos( $depart, 'Grimbergen' ) ||
strpos( $depart, 'Wezembeek-Oppem' ) ) {
$prix = 30;
}
// FROM ZAVENTEM TO ELSEWHERE IN BRUSSELS 34€
else if ( in_array( $codepostal2, $codepostalbruxelles ) !== false ) {
$prix = 30;
}
}
// FROM BRUSSELS TO Charleroi 68€
if ( strpos( $arrivee, 'Charleroi' ) !== false ||
strpos( $arrivee, 'Brussels South' ) !== false ) {
if ( in_array( $codepostal1, $codepostalbruxelles ) ) {
$prix = 68;
}
if ( in_array( $codepostal1, $codepostalperiph ) ) {
$prix = 68;
}
}
// FROM Charleroi TO BRUSSELS 68€
if ( strpos( $depart, 'Charleroi' ) !== false || strpos( $depart, 'Brussels South' ) !== false ) {
if ( in_array( $codepostal2, $codepostalbruxelles ) ) {
$prix = 68;
}
if ( in_array( $codepostal2, $codepostalperiph ) ) {
$prix = 68;
}
}
// FROM Charleroi TO Zaventem 73€
if ( strpos( $depart, 'Zaventem' ) !== false && strpos( $arrivee, 'Charleroi' ) !== false ) {
$prix = 73;
}
if ( strpos( $arrivee, 'Zaventem' ) !== false && strpos( $depart, 'Charleroi' ) !== false ) {
$prix = 73;
}
if ( $double == 'Aller simple' && $passagers == '4-8' ) {
$prix = $prix + 15;
}
if ( $double == 'Aller-retour' && $passagers == '1-4' ) {
$prix = ( $prix * 2 );
}
if ( $double == 'Aller-retour' && $passagers == '4-8' ) {
$prix = ( $prix * 2 ) + 20;
}
/*je ne sais plus ici -----> maintenant si */
function dies( $error ) {
// your error code can go here
echo "<center><p>Le formulaire contient les erreurs suivantes :<br /></p>";
echo "<p>" . $error . "</p>";
echo "<p>Veuillez retourner vers le formulaire et corriger les données manquantes, merci.<p>";
echo "<a href=\"javascript:history.go(-1)\" class='btn2' >Completer le formulaire</a></p></center>";
/*j'ai supprimé le code html jaune erreur quand le formulaire est vide */
die();
} /* fin dies erreur */
$error_message = "";
if ( empty( $_POST[ 'codepostal1' ] ) ) {
if ( strpos( $depart, 'Brussels Airport' ) === false ) {
if ( strpos( $depart, 'Brussels South' ) === false ) {
$error_message .= 'Le code postal de votre point de départ est nécessaire.<br />';
}
}
}
if ( empty( $_POST[ 'codepostal2' ] ) ) {
if ( strpos( $arrivee, 'Brussels Airport' ) === false ) {
if ( strpos( $arrivee, 'Brussels South' ) === false ) {
$error_message .= 'Le code postal de votre destination est nécessaire.<br />';
}
}
}
if ( strlen( $error_message ) > 0 ) {
$previous = "javascript:history.go(-1)";
if ( isset( $_SERVER[ 'HTTP_REFERER' ] ) ) {
$previous = $_SERVER[ 'HTTP_REFERER' ];
dies( $error_message );
}
}
?>
<a name="anchor"></a><!-- ça renvois ici le resulat du calcule -->
<center><!-- renvois vers la page du site "action" NORMALEMENT VERS UN NOUVEAU FORMUALAIRE "Inscription "-->
<form action='Formulaire2Refait.php#anchor' method='post'>
<table width="100%" class="colorbox-cont">
<tr>
<td width="50px" class="yellowboxlefttopdark">
<center><i class="fa fa-cab fa-2x"></i>
</center>
</td>
<td colspan="3" width="auto" class="whiteboxrighttopdark">
<p style="font-size:1em;">
Prix de votre course en Taxi
</p>
</td>
</tr>
<tr>
<td width="50px" class="yellowboxleft">
<center><span style="font-size:1em;">Départ</span>
</center>
</td>
<td colspan="3" width="auto" class="whiteboxright">
<p style="font-size:1em;padding-left:1.6%;padding-right:1.6%;">
<?php
echo $depart;
?>
</p>
</td>
</tr>
<tr>
<td width="50px" class="yellowboxleft">
<center><span style="font-size:1em;">Arrivée</span>
</center>
</td>
<td colspan="3" class="whiteboxright">
<p style="font-size:1em;padding-left:1.6%;padding-right:1.6%;">
<?php
echo $arrivee;
?>
</p>
</td>
</tr>
<tr>
<td width="50px" class="yellowboxleft">
<center><span style="font-size:1em;">Durée</span>
</center>
</td>
<td colspan="3" class="whiteboxright">
<p style="font-size:1em;padding-left:1.6%;padding-right:1.6%;">
<?php
echo 'approx. ';
echo (int) $dureetrajet;
echo ' min.';
?>
</p>
</td>
</tr>
<tr>
<td width="50px" class="yellowboxleftbot">
<center><span style="font-size:1em;">Distance</span>
</center>
</td>
<td colspan="3" class="whiteboxmidbot">
<p>
<?php
echo (int) $distanceenkm." km";
?>
</p>
</td>
</tr>
<tr>
<td width="50px" class="yellowboxleftbot">
<center><span style="font-size:1em;">Prix</span>
</center>
</td>
<td colspan="3" class="whiteboxmidbot">
<p><span style="font-size:1.8em;color:#51e401;font-weight:bold;padding-left:1.6%;padding-right:1.6%;">
<span style="font-size:1.4em;padding-top:10px;">
<?php
echo (int) $prix;
?>
</span>
<?php
echo ' €';
?>
</span>
</p>
</td>
</tr>
<tr>
<td width="50px" class="yellowboxleftbot">
<center><span style="font-size:1em;">Type de voyage</span>
</center>
</td>
<td colspan="3" class="whiteboxmidbot">
<p>
<?php
echo $double;
?>
</p>
</td>
</tr>
<tr>
<td width="50px" class="yellowboxleftbot">
<center><span style="font-size:1em;">Nombre de passagers</span>
</center>
</td>
<td colspan="3" class="whiteboxmidbot">
<p>
<?php
echo $passagers;
?>
</p>
</td>
</tr>
</tr>
<td colspan="4" class="whiteboxmidbot" style="vertical-align:top;padding-left:0px;;">
<input type="hidden" name="distanceenkm" value="<?php echo $distanceenkm ?>">
<input type="hidden" name="prix" value="<?php echo $prix ?>">
<input type="hidden" name="dureetrajet" value="<?php echo $dureetrajet ?>">
<input type="hidden" name="depart" value="<?php echo $depart ?>">
<input type="hidden" name="arrivee" value="<?php echo $arrivee ?>">
<input type="hidden" name="double" value="<?php echo $double ?>">
<input type="hidden" name="passagers" value="<?php echo $passagers ?>">
<input type='submit' value='Réserver mon taxi' name='reservation' class="btn2" style="margin-top:0px !important;"/>
</td>
</tr>
</table>
</form><!-- FIN resulat du calcule -->
</center>
<?php
}
?>
<!-- Réservation en ligne Si le prix existe -->
<?php
if ( isset( $_POST[ 'prix' ] ) ) {
?>
<!-- fonctionne sans send_form_email.php-->
<form name="orderform" method="post" action="envois_formulaire.php" accept-charset="UTF-8">
<table width="100%" class="colorbox-cont tableau2">
<tr>
<td width="50px" class="yellowboxlefttopdark ">
<i style="padding:5px 5px ;" class="fa fa-cab"></i>
</td>
<td width="auto" class="whiteboxrighttopdark">
<h2 style="padding:5px 0px ;">Réservation en ligne</h2>
</td>
</tr>
<tr>
<td colspan="2" class="whiteboxright" style="min-width:25%;">
<p style="margin:10px 10px;">
Veuillez remplir ce formulaire afin de compléter votre réservation. Une confirmation sera envoyé dans les plus brefs délais.
</p>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label for="first_name" style="margin-left:10px;">Titre <span class="red">*</span></label>
</td>
<td>
<input type="radio" name="titre" value="Monsieur"/><label class="" for="nom" id="">Mr</label> <input type="radio" name="titre" value="Madame"/><label class="" for="nom" id="">Mme</label>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label for="last_name" style="margin-left:10px;">Nom <span class="red">*</span></label>
</td>
<td>
<input class="" type="text" name="last_name" id=""/>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" for="telephone" id="" style="margin-left:10px;">Téléphone <span class="red">*</span></label>
</td>
<td>
<input class="" type="text" name="telephone" id=""/>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" for="email" id="" style="margin-left:10px;">E-mail <span class="red">*</span></label>
</td>
<td>
<input class="" type="text" name="email" id="email"/>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" for="date" id="" style="margin-left:10px;">Date du trajet</label>
</td>
<td>
<input type="date" name="date"/>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" for="heure" id="" style="margin-left:10px;">Heure de départ</label>
</td>
<td>
<select class="" style="" id="heure" name="heure" style="margin-left:10px;">
<option value="">Choisir</option>
<option value="08h00"> 08h00 </option>
<option value="08h15"> 08h15 </option>
<option value="08h30"> 08h30 </option>
<option value="08h45"> 08h45 </option>
<option value="09h00"> 09h00 </option>
<option value="09h15"> 09h15 </option>
<option value="09h30"> 09h30 </option>
<option value="09h45"> 09h45 </option>
<option value="10h00"> 10h00 </option>
<option value="10h15"> 10h15 </option>
<option value="10h30"> 10h30 </option>
<option value="10h45"> 10h45 </option>
<option value="11h00"> 11h00 </option>
<option value="11h15"> 11h15 </option>
<option value="11h30"> 11h30 </option>
<option value="11h45"> 11h45 </option>
<option value="12h00"> Midi </option>
<option value="12h15"> 12h15 </option>
<option value="12h30"> 12h30 </option>
<option value="12h45"> 12h45 </option>
<option value="13h00"> 13h00 </option>
<option value="13h15"> 13h15 </option>
<option value="13h30"> 13h30 </option>
<option value="13h45"> 13h45 </option>
<option value="14h00"> 14h00 </option>
<option value="14h15"> 14h15 </option>
<option value="14h30"> 14h30 </option>
<option value="14h45"> 14h45 </option>
<option value="15h00"> 15h00 </option>
<option value="15h15"> 15h15 </option>
<option value="15h30"> 15h30 </option>
<option value="15h45"> 15h45 </option>
<option value="16h00"> 16h00 </option>
<option value="16h15"> 16h15 </option>
<option value="16h30"> 16h30 </option>
<option value="16h45"> 16h45 </option>
<option value="17h00"> 17h00 </option>
<option value="17h15"> 17h15 </option>
<option value="17h30"> 17h30 </option>
<option value="17h45"> 17h45 </option>
<option value="18h00"> 18h00 </option>
<option value="18h15"> 18h15 </option>
<option value="18h30"> 18h30 </option>
<option value="18h45"> 18h45 </option>
<option value="19h00"> 19h00 </option>
<option value="19h15"> 19h15 </option>
<option value="19h30"> 19h30 </option>
<option value="19h45"> 19h45 </option>
<option value="20h00"> 20h00 </option>
<option value="20h15"> 20h15 </option>
<option value="20h30"> 20h30 </option>
<option value="20h45"> 20h45 </option>
<option value="21h00"> 21h00 </option>
<option value="21h15"> 21h15 </option>
<option value="21h30"> 21h30 </option>
<option value="21h45"> 21h45 </option>
<option value="22h00"> 22h00 </option>
<option value="22h15"> 22h15 </option>
<option value="22h30"> 22h30 </option>
<option value="22h45"> 22h45 </option>
<option value="23h00"> 23h00 </option>
<option value="23h15"> 23h15 </option>
<option value="23h30"> 23h30 </option>
<option value="23h45"> 23h45 </option>
<option value="Minuit"> 00h00 </option>
<option value="00h15"> 00h15 </option>
<option value="00h30"> 00h30 </option>
<option value="00h45"> 00h45 </option>
<option value="01h00"> 01h00 </option>
<option value="01h15"> 01h15 </option>
<option value="01h30"> 01h30 </option>
<option value="01h45"> 01h45 </option>
<option value="02h00"> 02h00 </option>
<option value="02h15"> 02h15 </option>
<option value="02h30"> 02h30 </option>
<option value="02h45"> 02h45 </option>
<option value="03h00"> 03h00 </option>
<option value="03h15"> 03h15 </option>
<option value="03h30"> 03h30 </option>
<option value="03h45"> 03h45 </option>
<option value="04h00"> 04h00 </option>
<option value="04h15"> 04h15 </option>
<option value="04h30"> 04h30 </option>
<option value="04h45"> 04h45 </option>
<option value="05h00"> 05h00 </option>
<option value="05h15"> 05h15 </option>
<option value="05h30"> 05h30 </option>
<option value="05h45"> 05h45 </option>
<option value="06h00"> 06h00 </option>
<option value="06h15"> 06h15 </option>
<option value="06h30"> 06h30 </option>
<option value="06h45"> 06h45 </option>
<option value="07h00"> 07h00 </option>
<option value="07h15"> 07h15 </option>
<option value="07h30"> 07h30 </option>
<option value="07h45"> 07h45 </option>
</select>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" id="" style="margin-left:10px;">Voyage</label>
</td>
<td>
<?php
echo $_POST ['double'];
?>
</td>
</tr>
<tr style="display:none;">
<td>
<input class="" type="text" name="double" value="<?php
echo $_POST ['double'];
?>"/>
</td>
</tr>
<?php
if (($_POST['double'] == 'Aller-retour') !== false) {
echo "<tr>
<td>
<label class='' id='' style='margin-left:10px;'>Date retour</label>
</td>
<td>
<input class='' type='date' name='billetaller' />
</td>
</tr>";
if (strpos($_POST['arrivee'], 'Brussels Airport') !== false || strpos($_POST['arrivee'], 'Brussels South') !== false) {
echo "<tr>
<td>
<label class='' id='' style='margin-left:10px;'>N° de vol retour</label>
</td>
<td>
<input class='' type='text' size='8' name='billetretour' />
</td>
</tr>"; }
else { echo "<tr>
<td style='min-width:25%;'>
<label class='' for='heureretour' id='' style='margin-left:10px;'>Heure du retour</label>
</td>
<td >
<select class='' style='' id='heureretour' name='heureretour' style='margin-left:10px;'>
<option value=''>Choisir</option>
<option value='08h00'> 08h00 </option>
<option value='08h15'> 08h15 </option>
<option value='08h30'> 08h30 </option>
<option value='08h45'> 08h45 </option>
<option value='09h00'> 09h00 </option>
<option value='09h15'> 09h15 </option>
<option value='09h30'> 09h30 </option>
<option value='09h45'> 09h45 </option>
<option value='10h00'> 10h00 </option>
<option value='10h15'> 10h15 </option>
<option value='10h30'> 10h30 </option>
<option value='10h45'> 10h45 </option>
<option value='11h00'> 11h00 </option>
<option value='11h15'> 11h15 </option>
<option value='11h30'> 11h30 </option>
<option value='11h45'> 11h45 </option>
<option value='12h00'> Midi </option>
<option value='12h15'> 12h15 </option>
<option value='12h30'> 12h30 </option>
<option value='12h45'> 12h45 </option>
<option value='13h00'> 13h00 </option>
<option value='13h15'> 13h15 </option>
<option value='13h30'> 13h30 </option>
<option value='13h45'> 13h45 </option>
<option value='14h00'> 14h00 </option>
<option value='14h15'> 14h15 </option>
<option value='14h30'> 14h30 </option>
<option value='14h45'> 14h45 </option>
<option value='15h00'> 15h00 </option>
<option value='15h15'> 15h15 </option>
<option value='15h30'> 15h30 </option>
<option value='15h45'> 15h45 </option>
<option value='16h00'> 16h00 </option>
<option value='16h15'> 16h15 </option>
<option value='16h30'> 16h30 </option>
<option value='16h45'> 16h45 </option>
<option value='17h00'> 17h00 </option>
<option value='17h15'> 17h15 </option>
<option value='17h30'> 17h30 </option>
<option value='17h45'> 17h45 </option>
<option value='18h00'> 18h00 </option>
<option value='18h15'> 18h15 </option>
<option value='18h30'> 18h30 </option>
<option value='18h45'> 18h45 </option>
<option value='19h00'> 19h00 </option>
<option value='19h15'> 19h15 </option>
<option value='19h30'> 19h30 </option>
<option value='19h45'> 19h45 </option>
<option value='20h00'> 20h00 </option>
<option value='20h15'> 20h15 </option>
<option value='20h30'> 20h30 </option>
<option value='20h45'> 20h45 </option>
<option value='21h00'> 21h00 </option>
<option value='21h15'> 21h15 </option>
<option value='21h30'> 21h30 </option>
<option value='21h45'> 21h45 </option>
<option value='22h00'> 22h00 </option>
<option value='22h15'> 22h15 </option>
<option value='22h30'> 22h30 </option>
<option value='22h45'> 22h45 </option>
<option value='23h00'> 23h00 </option>
<option value='23h15'> 23h15 </option>
<option value='23h30'> 23h30 </option>
<option value='23h45'> 23h45 </option>
<option value='Minuit'> 00h00 </option>
<option value='00h15'> 00h15 </option>
<option value='00h30'> 00h30 </option>
<option value='00h45'> 00h45 </option>
<option value='01h00'> 01h00 </option>
<option value='01h15'> 01h15 </option>
<option value='01h30'> 01h30 </option>
<option value='01h45'> 01h45 </option>
<option value='02h00'> 02h00 </option>
<option value='02h15'> 02h15 </option>
<option value='02h30'> 02h30 </option>
<option value='02h45'> 02h45 </option>
<option value='03h00'> 03h00 </option>
<option value='03h15'> 03h15 </option>
<option value='03h30'> 03h30 </option>
<option value='03h45'> 03h45 </option>
<option value='04h00'> 04h00 </option>
<option value='04h15'> 04h15 </option>
<option value='04h30'> 04h30 </option>
<option value='04h45'> 04h45 </option>
<option value='05h00'> 05h00 </option>
<option value='05h15'> 05h15 </option>
<option value='05h30'> 05h30 </option>
<option value='05h45'> 05h45 </option>
<option value='06h00'> 06h00 </option>
<option value='06h15'> 06h15 </option>
<option value='06h30'> 06h30 </option>
<option value='06h45'> 06h45 </option>
<option value='07h00'> 07h00 </option>
<option value='07h15'> 07h15 </option>
<option value='07h30'> 07h30 </option>
<option value='07h45'> 07h45 </option>
</select>
</td>
</tr>";}
}
else {
if (strpos($_POST['depart'], 'Brussels Airport') !== false || strpos($_POST['depart'], 'Brussels South') !== false) {
echo "<tr>
<td>
<label class='' id='' style='margin-left:10px;'>N° de votre vol</label>
</td>
<td>
<input class='' type='text' size='8' name='billetdepart' />
</td>
</tr>"; }
}?>
<tr>
<td style="min-width:25%;">
<label class="" id="" style="margin-left:10px;">Nombre de passagers</label>
</td>
<td>
<?php
echo $_POST ['passagers'];
?>
</td>
</tr>
<tr style="display:none;">
<td>
<input class="" type="text" name="passagers" value="<?php
echo $_POST ['passagers'];
?>"/>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" id="" style="margin-left:10px;">Lieu de départ</label>
</td>
<td>
<?php
echo $_POST ['depart'];
?>
</td>
</tr>
<tr style="display:none;">
<td>
<input class="" type="text" name="depart" value="<?php
echo $_POST ['depart'];
?>"/>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" id="" style="margin-left:10px;">Destination</label>
</td>
<td>
<?php
echo $_POST ['arrivee'];
?>
</td>
</tr>
<tr style="display:none;">
<td colspan="2">
<input class="" type="text" name="arrivee" value="<?php
echo $_POST ['arrivee'];
?>"/>
</td>
</tr>
<tr>
<td style="min-width:25%;">
<label class="" for="" id="" style="margin-left:10px;">Prix</label>
</td>
<td>
<?php
echo (int) $_POST ['prix'].' €';
?>
</td>
</tr>
<tr style="display:none;">
<td>
<input class="" type="text" name="prix" value="<?php
echo (int) $_POST ['prix'].' €';
?>"/>
</td>
</tr>
<tr>
<table border=0 cellspacing=0 cellpadding=0 class='tableau2' style="width:100%;padding:10px 0px 0px 5%;float: left;">
<td colspan="2" class='champ' style="padding-left:15px;">N° Vol aller <input type='text' name='volaller' size='auto' style="width:100%;max-width:100px;"/>
</td>
</tr>
<tr>
<table border=0 cellspacing=0 cellpadding=0 class='tableau2' style="width:100%;padding:10px 0px 0px 5%;float: left;">
<td colspan="2" class='champ' style="padding-left:15px;">N° Vol retour <input type='text' name='volretour' size='auto' style="width:100%;max-width:100px;"/>
</td>
</tr>
<tr>
<table border=0 cellspacing=0 cellpadding=0 class='tableau2' style="width:100%;padding:10px 0px 0px 5%;float: left;">
<td colspan="2" class='champ' style="padding-left:15px;">Remarque <input type='text' name='remarque' size='auto' style="width:100%;max-width:300px;"/>
</td>
<tr>
<td colspan="2" width="100%" style="padding-top:10px;">
<input type="hidden" name="dureetrajet" value="<?php echo (int) $_POST ['dureetrajet']; ?>">
<input type="hidden" name="distanceenkm" value="<?php echo (int) $_POST ['distanceenkm'].' km'; ?>">
<input type='submit' value='Envoyer ma réservation' name='submit' class="btn2"/>
</td>
</tr>
</form>
<?php } ?>
Fichier "envois_formulaire.php" :
<body>
<?php
date_default_timezone_set('Europe/Brussels');
$date2 = date('d/m/Y h:i:s a', time());
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "nachit.n@gmail.com";
$email_subject = "TX".$date2;
function died($error) {
// your error code can go here
echo "Désolé, le formulaire contient des erreurs. ";
echo "Les erreurs sont les suivantes :<br /><br />";
echo $error."<br /><br />";
echo "Veuillez corriger ces erreurs, merci.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone'])) {
died('Votre formulaire semble contenir des erreurs, veuillez réessayer, merci.');
}
$titre = $_POST['titre']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email'];// required
$telephone = $_POST['telephone']; // required
$distanceenkm = $_POST['distanceenkm']; // required
$prix = $_POST['prix']; // required
$dureetrajet = $_POST['dureetrajet']; // required
$depart = $_POST['depart']; // required
$arrivee = $_POST['arrivee']; // required
$date = $_POST['date']; // required
$heure = $_POST['heure']; // required
$double = $_POST['double'];
$passagers = $_POST['passagers'];
$billetaller = $_POST['billetaller'];
$billetretour = $_POST['billetretour'];
$billetdepart = $_POST['billetdepart'];
$heureretour = $_POST['heureretour'];
/* remarque */
$remarque = $_POST['remarque'];
/* aller */
$volaller = $_POST['volaller'];
$volretour = $_POST['volretour'];
/*retour*/
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'Cette adresse e-mail ne semble pas être valide.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$titre)) {
$error_message .= 'Veuillez indiquer votre titre, merci.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'Le nom indiqué est non-valide.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Taxi en ligne.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Titre : ".clean_string($titre)."\n";
$email_message .= "Nom : ".clean_string($last_name)."\n";
$email_message .= "Tel: ".clean_string($telephone)."\n";
$email_message .= "E-mail: ".clean_string($email_from)."\n\n";
$email_message .= "Depart : ".clean_string($depart)."\n\n";
$email_message .= "Destination : ".clean_string($arrivee)."\n\n";
$email_message .= "Date : ".clean_string($date)."\n";
$email_message .= "Heure : ".clean_string($heure)."\n";
$email_message .= "Voyage : ".clean_string($double)."\n";
if (strpos($depart, 'Brussels Airport') !== false || strpos($depart, 'Brussels South') !== false) {
$email_message .= "Num de vol : ".clean_string($billetdepart)."\n";
}
if ($double == 'Aller-retour') {
$email_message .= "Date du retour : ".clean_string($billetaller)."\n";
if (strpos($arrivee, 'Brussels Airport') !== false || strpos($arrivee, 'Brussels South') !== false) {
$email_message .= "Num de vol retour : ".clean_string($billetretour)."\n";
}
else {
if(($_POST['heureretour']) !== 'Choisir'){
$email_message .= "Heure du retour : ".clean_string($heureretour)."\n";}
}
}
$email_message .= "Passagers : ".clean_string($passagers)."\n";
$email_message .= "Prix : ".clean_string($prix)."\n";
$email_message .= "Distance : ".clean_string($distanceenkm)."\n";
$email_message .= "Durée +/- : ".clean_string($dureetrajet)."\n";
/* remarque */
$email_message .= "Vol aller : ".clean_string($volaller)."\n";
$email_message .= "Vol retour : ".clean_string($volretour)."\n";
$email_message .= "Remarque : ".clean_string($remarque)."\n";
// create email headers
$headers .= "From: reservation@go-taxi-airport.com\r\n"."Reply-To: ".$email_from."\r\n"."X-Mailer: PHP/". phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
<p style="padding:1.6% 15px;">Merci de nous avoir contacté, l'un de nos collaborateurs vous contactera très prochainement.</p>
<?php
}
?>
</body>
Merci !
Modifié par webmaster83 (14 Aug 2018 - 11:59)