At 06:32 AM 5/22/2006, Jef Sullivan wrote:
$cur_month = date("m");
while ($r = mysql_fetch_array($month_query))
{
$v = $r["m_id"];
$out = $r["months"];
if( $cur_month = $v )
{
echo("<option selected=".$cur_month.
"value=".$v.">".$out."</option>")
}
....
}
You're definitely saving some server machine cycles there by
calculating the current month just once.
On the other hand, your code would output an option only when the
data month matched the current month. I'm under the impression that
the original poster wanted the user to be able to select from a list
of different months. Therefore I'd echo the option tag with every
iteration and include the selected attribute only when the month matched.
Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php