c_bou98
Invité n'ayant pas de compte PHPfrance
31 août 2011, 16:51
Tout fonctionne (presque) avec ce 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]))
{
$msg .= "\r\n".'a choisi "'.$choix[$i].'" pour '.$match[$i] ;
$i++;
}
$var = 'From '. $left.' <'.$right.'>' ."\r\n";
mail($destinataire, $sujet, $msg, $var);
?>
Je reçois donc ce mail :
From Pronostics <>
a choisi "Nul" pour St Florent des Bois - St Prouant/Monsireigne
a choisi "Domicile" pour Hermenault Sérigné - Grosbreuil
a choisi "Nul" pour Meilleraie-Tillay - St Aubin la Plaine
a choisi "Extérieur" pour Nieul le Dolent - Les Essarts 2
a choisi "Nul" pour Talmont St Hilare - Roche/Y Robretières 2
a choisi "Domicile" pour Roche/Y Généraudière - Nalliers Foot Espoir
Il ne me manque plus désormais qu'à comprendre comment rajouter avant chaque phrase : Prénom NOM (
[email protected]) a choisi..