Hey...So I have an array of checkboxes...I am going thru the values using a for loop, and trying to make a string out of them (ie. if breakfast, lunch, ferry are checked, i would like it to be breakfast, lunch, ferry)
...
I have my code but it repeats them (like breakfast, breakfast, lunch, breakfast, lunch, ferry) like that
here is my code:
*note: the checkboxes are named Descr[]
if(isset($_POST['Add'])){
if(isset($_POST["Descr"])) {
$Descr = $_POST["Descr"];
} else {
$Descr=array();
}
for ($i="0"; $i<count($Descr); $i++) {
if($Descr[$i] != null){
$q.=", ".$Descr[$i];
}
echo $q;
}
}
is because the array looks like this?:
element 1 = breakfast
element 2 = breakfastlunch
etc?? or am i just coding it horribly wrong
Thanks