I have given an array
$languages = ["C", "C++", "Java", "C#", "HTML", "CSS", "XML", "PHP", "JavaScript"];
and I have to generate checkboxes from them
and not like that
<input type="checkbox" name="languages []" value="C"/>C
<input type="checkbox" name="languages []" value="C++"/>C++
....
Is there a chance anyone could help me solving this problem, because I stucked myslelf, and I can't figure this out.
I tired something like that but it turns out it doesn't work proprly.
<?php
$jezyki = ["C", "C++", "Java", "C#", "HTML", "CSS", "XML", "PHP", "JavaScript"];
foreach($jezyki as $key=>$value){
echo '<input type="checkbox" name="' . 'jezyki[]' . '" />'. $value;
}
?>
Aucun commentaire:
Enregistrer un commentaire