Previously my code looked like this:
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
$field .= '<option value="' . xtc_parse_input_field_data($values[$i]['id'], array('"' => '"')) . '"';
if ($default == $values[$i]['id']) {
$field .= ' selected="selected"';
}
$field .= '>' . xtc_parse_input_field_data($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
}
Following some advice I changed it to:
if (is_array($values) && count($values) > 0) {
foreach ($values as $value) {
$field .= '<option value="' . xtc_parse_input_field_data($value['id'], array('"' => '"')) . '"';
if ($default == $value['id']) {
$field .= ' selected="selected"';
}
$field .= '>' . xtc_parse_input_field_data($value['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
}
}
But the error remains:
Notice: Undefined index: id in E:\xampp\htdocs\testshop\inc\xtc_draw_pull_down_menu.inc.php
What's causing this error?