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
| <?php if (isset($_POST['submit']))
{
// email par défaut
$email = 'email2@gmail.com';
// départements spéciaux
$tab_dpt = array(93, 95, 60, 62 , 80 , 59 , 02 ,27 , 28 , 76 , 14 , 50);
$cp = (isset($_POST['element_numeric'][4])) ? (int)$_POST['element_numeric'][4] : 0;
if ( ! empty($cp))
{
$dpt = (int)substr($cp, 0, 2);
if (in_array($dpt, $tab_dpt, true))
{
$email = 'email1@gmail.com';// code postal dans la liste (Bruno&Marc)
}
}
elseif (isset($_POST['element_numeric'][7]))
{
$n = (int)$_POST['element_numeric'][7];
if (($n >= 0) && ($n < 50))
{
$email = 'email1@gmail.com';// nbr de véhicules inférieur à 50 (Bruno&Marc)
}
}
$formName="Test";// en sortant du else le message et valable pour les 2 conditions
$emailSubject="Informations transmises par le formulaire";
?> |
Partager