1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| <?php
$default = array();
$default['txtNum'] = isset($_POST['txtNum'])?$_POST['txtNum']:'';
$default['txtSociete'] = isset($_POST['txtSociete'])?$_POST['txtSociete']:'';
....................
......................
............................
if (isset($_POST['cmdEnvoyer'])) {
require_once('TestFormulaire.php');
// Register the subclasses to use
$v['er'] = new ValidateRequired('Nom', $_POST['txtNom']);
$v['s'] = new ValidateRequired('Prénom', $_POST['txtPrenom']);
$v['t'] = new ValidateRequired('Adresse', $_POST['txtAdresse']);
$v['u'] = new ValidateRequired('Code Postal', $_POST['txtCP']);
$v['v'] = new ValidateRequired('Ville', $_POST['txtVille']);
$v['w'] = new ValidateRequired('Téléphone', $_POST['txtTelephone']);
$v['x'] = new ValidateRequired('N° de série', $_POST['txtNumSerie']);
$v['y'] = new ValidateRequired('1ère mise en circulation', $_POST['txtMiseEnCircu']);
$v['e'] = new ValidateEmail($_POST['txtMail']);
$errorMsg = '';
// Perform each validation
foreach($v as $validator) {
if (!$validator->isValid()) {
while ($error=$validator->getError()) {
$errorMsg.="<li>".$error."</li>\n";
}
}
}
if ($errorMsg != '') {
print ("<div style='color:red'>Les erreurs suivantes se sont produites:\n<ul>".$errorMsg."</ul></div>");
} else {
$Num = $_POST['txtNum'];
$Societe = $_POST['txtSociete'];
$Nom = $_POST['txtNom'];
$Prenom = $_POST['txtPrenom'];
$Mail = $_POST['txtMail'];
$Adresse=$_POST['txtAdresse'];
$CP=$_POST['txtCP'];
$Ville=$_POST['txtVille'];
$Telephone=$_POST['txtTelephone'];
if($_POST['cmbNumSerie']=="WDB") $TypeSerie ="WDB";
elseif($_POST['cmbNumSerie']=="WDC") $TypeSerie ="WDC";
elseif($_POST['cmbNumSerie']=="VSA") $TypeSerie ="VSA";
else $TypeSerie ="WDF";
$NumSerie=$_POST['txtNumSerie'];
$MiseEnCircu=$_POST['txtMiseEnCircu'];
$Des1=$_POST['txtDes1'];
if($_POST['cmbRef1']=="") $TypeRef1 ="";
elseif($_POST['cmbRef1']=="Mercedes") $TypeRef1 ="Mercedes";
else $TypeRef1="---";
$Ref1=$_POST['txtRef1'];
$Qte1=$_POST['txtQte1'];
$Des2=$_POST['txtDes2'];
if($_POST['cmbRef2']=="") $TypeRef2 ="";
elseif($_POST['cmbRef2']=="Mercedes") $TypeRef2 ="Mercedes";
else $TypeRef2="---";
$Ref2=$_POST['txtRef2'];
$Qte2=$_POST['txtQte2'];
$Des3=$_POST['txtDes3'];
if($_POST['cmbRef3']=="") $TypeRef3 ="";
elseif($_POST['cmbRef3']=="Mercedes") $TypeRef3 ="Mercedes";
else $TypeRef3="---";
$Ref3=$_POST['txtRef3'];
$Qte3=$_POST['txtQte3'];
$Commentaire=$_POST['txtCommentaire'];
$Destinataire = "nicolas.@.fr" ;
if($_POST['optChoix']=="Devis") $Sujet =" - Devis";
else $Sujet="- Commande";
$Message = "Client n° : $Num \n
Société : $Societe \n
Nom : $Nom \n
Prénom : $Prenom \n
Adresse : $Adresse \n
Code Postal : $CP \n
Ville : $Ville \n
Téléphone : $Telephone \n \n
Véhicule concerné : \n
N° de série : $TypeSerie $NumSerie \n
Mis en circualtion : $MiseEnCircu \n \n
Détail de la demande : \n
Désignation 1 : $Des1 \n
Référence 1 : $TypeRef1 $Ref1 \n
Le client en souhaite $Qte1 \n \n
Désignation 2 : $Des2 \n
Référence 2 : $TypeRef2 $Ref2 \n
Le client en souhaite $Qte2 \n \n
Désignation 3 : $Des3 \n
Référence 3 : $TypeRef3 $Ref3 \n
Le client en souhaite $Qte3 \n \n \n
Commentaire du client : $Commentaire ";
$Entetes = "From: $Mail " ;
mail($Destinataire, $Sujet, $Message, $Entetes);
print ('<h2>Demande envoyée avec succès !</h2>');
}
}
?>
<form name="Formulaire_Mail" action="<?php echo ($_SERVER['PHP_SELF']); ?>" method="post">
<table width="95%" height="921" id="tabGeneral">
<tr>
<td height="72" colspan="4" class="GrosTitredePageGris"><div align="left" class="GrosTitredePageRouge">Nos Services en ligne </div></td>
</tr>
<tr>
<td height="40" align="center" valign="top"> </td>
<td colspan="2" align="center" valign="top"><div align="left">Les champs marqués d'une<span class="Style5"> *</span> sont obligatoire </div></td>
</tr>
<tr>
<td width="82" height="40" align="center" valign="top">
<p align="left" class="InfosSites"> </p> </td>
<td width="299" align="center" valign="top">
<label>
<div align="left">
<input type="radio" name="optChoix" value="Devis" />
<span class="InfosSites Style4">Devis</span></div>
</label> </td>
<td width="559" align="center" valign="top">
<label>
<div align="left">
<input type="radio" name="optChoix" value="Commande" />
<span class="InfosSites Style4">Commande</span><span class="Style1"> *</span></div>
</label> </td>
................
..................................
</table>
</form> |
Partager