Gayner Posted August 27, 2009 Share Posted August 27, 2009 $this->output .= "<form name=\"form\" method=\"post\">"; $styles = array(); $d = dir('images/flags'); while (($entry = $d->read()) !== false) { if (substr($entry, strlen($entry)-4) == '.gif') $styles[] = substr($entry, 0, strlen($entry)-4); } $d->close(); // Only display the style selection box if there's more than one style available if (count($styles) == 1) echo "\t\t\t".'<div><input type="hidden" name="skin" value="'.$styles[0].'" /></div>'."\n"; else if (count($styles) > 1) { natsort($styles); $this->output .= "Select your Country: <select name=skin>"; while (list(, $temp) = @each($styles)) { if ($mm['style'] == $temp) $this->output .= '<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'; else $this->output .= '<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'; } $this->output .= "</select>"; } Shows: But I save it to database using this: mysql_query("UPDATE ibf_members SET skin='{$_POST['skin']}' WHERE id={$ibforums->member['id']}"); it works fine and saves which one I chose, but it's not being "select=selected" while (list(, $temp) = @each($styles)) { if ($mm['style'] == $temp) $this->output .= '<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'; else $this->output .= '<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'; } that's the part that's supposed to make it selected but it not working Link to comment https://forums.phpfreaks.com/topic/172069-its-not-staying-selected/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.