I use a php checkbox and I want to retrieve marked values.
My checkbox code :
<label for="cours">Je suis intéressé par un ou plusieurs cours :</label><br><br>
<input type="checkbox" name="cours" value="individuel">Individuel<br>
<input type="checkbox" name="cours" value="semiprive">Semi-privé<br>
<input type="checkbox" name="cours" value="minigroupe">Mini-groupe<br>
<input type="checkbox" name="cours" value="intensif">Intensif<br>
<input type="checkbox" name="cours" value="entreprise">Entreprises<br>
<input type="checkbox" name="cours" value="distance">A distance<br>
<input type="checkbox" name="cours" value="telephone">Par téléphone<br>
<input type="checkbox" name="cours" value="coaching">Coaching<br>
<input type="checkbox" name="cours" value="soutien">Soutien scolaire<br>
<input type="checkbox" name="cours" value="diplome">Diplômes officiels<br>
php :
<?php
if(isset($_POST['envoyer']))
{
if(get_magic_quotes_gpc())
{
$cours = stripslashes(trim($_POST['cours']));
}
}
?>
I want to put it in the variable msg :
$msg = 'Cours : '.$cours."\r\n";
and sending the message throw the php email function.
But when I do that like this a receive just the first checked choice...
Thank you for your help.
Michaël
You have to change the name attribute to cours[] and then php will treat it as an array.
Read up at http://docs.php.net/faq.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With