J'ai récupéré une page avec un formulaire de contact et je dois rajouter un item en checkbox, j'ai dépoussiéré voici mes codes :
<form name="form1" method="POST" action="_mail.php" onSubmit="return CheckAll(this);">
<table width="708" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="165" align="right" valign="top">Villes *: </td>
<td width="565" align="left" valign="top">
<input name="fieldnm_1" type="checkbox" value="Paris" />
Paris
<input name="fieldnm_1" type="checkbox" value="Lyon" />
Lyon
<input name="fieldnm_1" type="checkbox" value="Marseille" />
Marseille</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
<?php ob_start();
$fromemail="Prise de contact <[email protected]>";
$toemail="[email protected]";
$sub="Contactez nous";
$success_page_name="merci.html";
if($_SERVER['REQUEST_METHOD']=="POST")
{
$fieldnm_1=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_1']));
$contentmsg=stripslashes("<br><b><font style=color:#CC3300>$sub</font></b><br>
<table width=708 border=0 cellpadding=2 cellspacing=1 bgcolor=#CCCCCC>
<tr>
<td width=165 align=right valign=top bgcolor=#FFFFFF><B>Villes *:</b> </td>
<td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_1</td>
</tr>
</table>
");
$headers = "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";
$from=$fromemail;
$headers .= "From: ".$from."
";
@mail($toemail,$sub,$contentmsg,$headers);
header("Location:$success_page_name");
}
?>
Donc je réceptionne bien mon message mais je n'ai qu'une seule valeur de récupérée alors que j'en voudrais plusieurs si plusieurs sont cochées...J'ai rajouté au name de mes input
fieldnm_1[]
et collé un truc du genre$fieldnm_1=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_1'][$i]));
Mais bon impossible de récupérer cette liste, dans mon mail,Merci d'avance