Stumped with select function



I have a function that creates a select list:

function make_select_ns($name,$array,$persist){
$string = "<select name=\"$name\">";
$string .="<option selected>" . ucfirst($name) . "</option>\n";
if ($name == $array[0]){array_shift($array);} //removes duplicate when
table name equals 1st item in array
foreach ($array AS $value) {
if (($value == $persist) && is_string($persist)){$selected =
"selected";}
else {$selected = "";}
$string .= "<option $selected value='" .
str_pad($value,2,"0",STR_PAD_LEFT) . "'>$value</option>\n";
}
$string.="</select>";
print $string;
}

I have arrays for Months, Days, Years, Hours, and Minutes.

All of the arrays work as expected except for the minutes array which
starts at 0 and goes to 55 in increments of 5. Whenever this loads
after a post the value 0 is selected. What am I missing here? Why
does the zero seem to be causing me problems?

Let me know if you need more information.

Thanks,

-Mark

.



Relevant Pages

  • Re: Using INDEX twice??
    ... ...and then use conditional formatting to hide any error value that may ... to the first cell in the range) which meets the specified criteria. ... IF function returns an array of numbers, ... FALSE*TRUE equals 0 ...
    (microsoft.public.excel.worksheet.functions)
  • Re: compare two byte[] s
    ... All of the very similar overloaded methods in java.util.Arrays, for example, would fit neatly into instance methods of an array class. ... Since each array is its own special class, the virtual machine has to synthesize special class objects for arrays. ... One thing that could really bloat these objects would be to have to define methods for /every/ single array type. ... The equals methods are between 54 bytes and 78 bytes. ...
    (comp.lang.java.programmer)
  • Re: This should be easy...
    ... > saying if the range B2:D2 is blank, then column equals zero? ... and the results will be returned as an array which MAX works on. ... > "Total" cell. ...
    (microsoft.public.excel.worksheet.functions)
  • Simple Perl
    ... print header, start_html("Carrier Validation Test Architecture"), ... while values of the array are not empty. ... if the array value equals blank. ...
    (comp.lang.perl.misc)
  • Re: Discarding unread data after scanf()
    ... A call to fscanf with stdin as the first argument, ... ** If rc equals EOF, then the end of file was reached, ... then there is a string in the array. ... ** then the extra characters are discarded. ...
    (comp.lang.c)