rendered paste body function ctm_drwSelect($name,$data,$parameters='',$default=0) {
//print $default;
//print_r($_SESSION['post_data']);
if (is_array($data)) {
if ($_SESSION['post_data'][$name]) {
$default = $_SESSION['post_data'][$name];
}
$select = "<select name='$name'";
if ($parameters) {
$select .= " " . stripslashes($parameters);
}
$select .= ">\n";
$x=0;
//print_r($data);
foreach($data as $key => $value) {
print $x . " Key". $key ." Def". $default . " Ses" . $_SESSION['post_data'][$name] . "<BR>";
$select .= "<option value='$key'";
if ($default==0 && $x==$default) {
$select .= " selected";
}
// This is where i have the problem, where $key is a string and $default = 0, returns true regardless
elseif ($key == $default) {
$select .= " selected";
}
$select .= ">$value</option>\n";
$x++;
}
$select .= "</select>\n";
return $select;
}
else {
echo errorLog('ctm_drwSelect - Data parameter not a valid array.');
}
}