Search the Community
Showing results for tags 'array issues'.
-
Hi we are working some php code and we have created the drop down box but it is creating an array. We are trying to rewrite a piece of code that was originially written for select boxes but with 50 options that a bit too many select boxes and a drop down box is a lot cleaner. The dropdown box is created but the word "array" appears in the box and there are no options to choose from. Here is the code we are trying to get working. case 'multiselectbox': case 'selectbox': echo '<div class="editfield field_'.$field_id.' selectbox">'; $tt = array(); if($get_field) { $tt = $get_field; } foreach ($children as $child) { $child->name = trim ($child->name); $child = (in_array ($child->name, $tt ); echo '<input type="dropdown" name="'. $fieldName . '_' . $field_id . '" value="'. $children. '" style="width:20%" placeholder="Category" />'; echo '</div>'; break; Here is the code as it was originially written with the select boxes. case 'radio': case 'checkbox': echo '<div class="editfield field_'.$field_id.' checkbox">'; echo '<span class="label">' . $field_data->name. '</span>'; $tt = array(); if($get_field) { $tt = $get_field; } //echo '<div class="wppl-checkboxes-wrapper">'; foreach ($children as $child) { $child->name = trim ($child->name); $checked = (in_array ($child->name, $tt ) )? "checked='checked'": ""; echo '<label><input ' .$checked . ' type="checkbox" name="'. $fieldName . '_' . $field_id. '[]" value="'.$child->name.'" />'.$child->name.'</label>'; } //echo '</div>'; echo '</div>'; break; } // switch } echo '</div>'; } Can you please help us? Thank you