Mysql
 sql >> Base de données >  >> RDS >> Mysql

Lecture des valeurs de case à cocher à l'aide de la fonction implode

essayez ceci

if(isset($_POST['Submit'])) {
    echo "<pre>"; print_r($_POST);
    $checked = implode(',', $_POST['checkbox']); 
    echo $checked;
}

voici exactement ce que j'ai mis dans mon test.php

<?php
if(isset($_POST['Submit'])) {
    echo "<pre>";
    $checked = implode(',', $_POST['checkbox']);
    echo $checked;
}

?>
<form action="test.php" method="post">
<input type="checkbox" name="checkbox[]" value="hostess_name">
<input type="checkbox" name="checkbox[]" value="hostess_familyname_en">
<input type="checkbox" name="checkbox[]" value="hostess_id">
<input type="checkbox" name="checkbox[]" value="hostess_firstname_en">
<br>
<br>
<input type="submit" name="Submit" value="Submit">
</form>