Here is another useful dropdown menu list for forms. This will create a dropdown select of days of the weeks. It should be noted that the week begins on Monday which is day one, as defined by ISO-8601.
The PHP date function date('N') will return the ISO-8601 weekday number. This differs from the date('l') which returns the weekday, beginning with zero for Sunday. In ISO-8601, Sunday is number 7.
<?php /* * * @Create an HTML drop down menu * * @param string $name The element name and ID * * @param int $selected The day to be selected * * @return string * */function dayDropdown($name="day", $selected=null) { $wd = '<select name="'.$name.'" id="'.$name.'">';
0 comments:
Post a Comment