Voici mon nouveau code :
<?php
if(!empty($_POST['m1'])){
switch($_POST['m1'])
{
case('1'): { $choix[1]='Domicile'; break ; }
case('2'): { $choix[1]='Nul'; break ; }
case('3'): { $choix[1]='Extérieur'; break ; }
}
$match[1] = 'St Florent des Bois - St Prouant/Monsireigne';
}
if(!empty($_POST['m2'])){
switch($_POST['m2'])
{
case('1'): { $choix[2]='Domicile'; break ; }
case('2'): { $choix[2]='Nul'; break ; }
case('3'): { $choix[2]='Extérieur'; break ; }
}
$match[2] = 'Hermenault Sérigné - Grosbreuil';
}
if(!empty($_POST['m3'])){
switch($_POST['m3'])
{
case('1'): { $choix[3]='Domicile'; break ; }
case('2'): { $choix[3]='Nul'; break ; }
case('3'): { $choix[3]='Extérieur'; break ; }
}
$match[3] = 'Meilleraie-Tillay - St Aubin la Plaine';
}
if(!empty($_POST['m4'])){
switch($_POST['m4'])
{
case('1'): { $choix[4]='Domicile'; break ; }
case('2'): { $choix[4]='Nul'; break ; }
case('3'): { $choix[4]='Extérieur'; break ; }
}
$match[4] = 'Nieul le Dolent - Les Essarts 2';
}
if(!empty($_POST['m5'])){
switch($_POST['m5'])
{
case('1'): { $choix[5]='Domicile'; break ; }
case('2'): { $choix[5]='Nul'; break ; }
case('3'): { $choix[5]='Extérieur'; break ; }
}
$match[5] = 'Talmont St Hilare - Roche/Y Robretières 2';
}
if(!empty($_POST['m6'])){
switch($_POST['m6'])
{
case('1'): { $choix[6]='Domicile'; break ; }
case('2'): { $choix[6]='Nul'; break ; }
case('3'): { $choix[6]='Extérieur'; break ; }
}
$match[6] = 'Roche/Y Généraudière - Nalliers Foot Espoir';
}
$destinataire = '[email protected]';
$sujet = 'Résultats';
$left = 'Pronostics';
$right = '';
$msg = '';
$i=1;
while(isset($match[$i]))
{
$i++;
$msg .= "\r\n".'a choisi "'.$choix[$i].'" pour '.$match[$i] ;
}
$var = 'From '. $left.' <'.$right.'>' ."\r\n";
mail($destinataire, $sujet, $msg, $var);
?>
Et voici ce que je reçois par mail :
From Pronostics <>
a choisi "Domicile" pour Hermenault Sérigné - Grosbreuil
a choisi "Nul" pour Meilleraie-Tillay - St Aubin la Plaine
a choisi "Domicile" pour Nieul le Dolent - Les Essarts 2
a choisi "Nul" pour Talmont St Hilare - Roche/Y Robretières 2
a choisi "Nul" pour Roche/Y Généraudière - Nalliers Foot Espoir
a choisi "" pour
Comme vous pouvez le voir, mon match m1 ne s'affiche pas. De plus, je souhaitais que le nom de la personne, et son adresse mail entre parenthèse s'affichent avant "a choisi..". Exemple :
Prénom NOM (
[email protected]) a choisi "Domicile" pour Hermenault Sérigné - Grosbreuil
Merci de votre aide,
Voici mon nouveau code :
[php]
<?php
if(!empty($_POST['m1'])){
switch($_POST['m1'])
{
case('1'): { $choix[1]='Domicile'; break ; }
case('2'): { $choix[1]='Nul'; break ; }
case('3'): { $choix[1]='Extérieur'; break ; }
}
$match[1] = 'St Florent des Bois - St Prouant/Monsireigne';
}
if(!empty($_POST['m2'])){
switch($_POST['m2'])
{
case('1'): { $choix[2]='Domicile'; break ; }
case('2'): { $choix[2]='Nul'; break ; }
case('3'): { $choix[2]='Extérieur'; break ; }
}
$match[2] = 'Hermenault Sérigné - Grosbreuil';
}
if(!empty($_POST['m3'])){
switch($_POST['m3'])
{
case('1'): { $choix[3]='Domicile'; break ; }
case('2'): { $choix[3]='Nul'; break ; }
case('3'): { $choix[3]='Extérieur'; break ; }
}
$match[3] = 'Meilleraie-Tillay - St Aubin la Plaine';
}
if(!empty($_POST['m4'])){
switch($_POST['m4'])
{
case('1'): { $choix[4]='Domicile'; break ; }
case('2'): { $choix[4]='Nul'; break ; }
case('3'): { $choix[4]='Extérieur'; break ; }
}
$match[4] = 'Nieul le Dolent - Les Essarts 2';
}
if(!empty($_POST['m5'])){
switch($_POST['m5'])
{
case('1'): { $choix[5]='Domicile'; break ; }
case('2'): { $choix[5]='Nul'; break ; }
case('3'): { $choix[5]='Extérieur'; break ; }
}
$match[5] = 'Talmont St Hilare - Roche/Y Robretières 2';
}
if(!empty($_POST['m6'])){
switch($_POST['m6'])
{
case('1'): { $choix[6]='Domicile'; break ; }
case('2'): { $choix[6]='Nul'; break ; }
case('3'): { $choix[6]='Extérieur'; break ; }
}
$match[6] = 'Roche/Y Généraudière - Nalliers Foot Espoir';
}
$destinataire = '
[email protected]';
$sujet = 'Résultats';
$left = 'Pronostics';
$right = '';
$msg = '';
$i=1;
while(isset($match[$i]))
{
$i++;
$msg .= "\r\n".'a choisi "'.$choix[$i].'" pour '.$match[$i] ;
}
$var = 'From '. $left.' <'.$right.'>' ."\r\n";
mail($destinataire, $sujet, $msg, $var);
?>
[/php]
Et voici ce que je reçois par mail :
From Pronostics <>
a choisi "Domicile" pour Hermenault Sérigné - Grosbreuil
a choisi "Nul" pour Meilleraie-Tillay - St Aubin la Plaine
a choisi "Domicile" pour Nieul le Dolent - Les Essarts 2
a choisi "Nul" pour Talmont St Hilare - Roche/Y Robretières 2
a choisi "Nul" pour Roche/Y Généraudière - Nalliers Foot Espoir
a choisi "" pour
Comme vous pouvez le voir, mon match m1 ne s'affiche pas. De plus, je souhaitais que le nom de la personne, et son adresse mail entre parenthèse s'affichent avant "a choisi..". Exemple :
Prénom NOM (
[email protected]) a choisi "Domicile" pour Hermenault Sérigné - Grosbreuil
Merci de votre aide,