PHP Resources
Home
Books
Directories
Magazines
Non-English Sites
Online Communities
Tools
Tutorials and Articles
Web Hosting
PHP Functions
PHP News Groups *
PHP Reference
Smarty Reference
Pear Reference
PHP-GTK Reference

By submitting PHP Resources you own, or know of, you'll help us build the largest PHP Resource website on the net. Please double check that your resource doesn't already exist before you submit it!!. We thank you for helping make this a better website.









Resource Image Newest ResourcesPopular ResourcesTop Resources Resource Image
PHP Resources
{html_select_time}

{html_select_time}

{html_select_time} is a custom function that creates time dropdowns for you. It can display any or all of hour, minute, second and meridian.

The time attribute can have different formats. It can be a unique timestamp, a string of the format YYYYMMDDHHMMSS or a string that is parseable by PHP's strtotime().

Attribute NameTypeRequiredDefaultDescription
prefixstringNoTime_What to prefix the var name with
timetimestampNocurrent timeWhat date/time to use
display_hoursbooleanNoTRUEWhether or not to display hours
display_minutesbooleanNoTRUEWhether or not to display minutes
display_secondsbooleanNoTRUEWhether or not to display seconds
display_meridianbooleanNoTRUEWhether or not to display meridian (am/pm)
use_24_hoursbooleanNoTRUEWhether or not to use 24 hour clock
minute_intervalintegerNo1Number interval in minute dropdown
second_intervalintegerNo1Number interval in second dropdown
field_arraystringNon/aOutputs values to array of this name
all_extrastringNonullAdds extra attributes to select/input tags if given
hour_extrastringNonullAdds extra attributes to select/input tags if given
minute_extrastringNonullAdds extra attributes to select/input tags if given
second_extrastringNonullAdds extra attributes to select/input tags if given
meridian_extrastringNonullAdds extra attributes to select/input tags if given

Example 8-21. {html_select_time}

{html_select_time use_24_hours=true}

At 9:20 and 23 seconds in the morning the template above would output:

<select name="Time_Hour">
<option value="00">00</option>
<option value="01">01</option>
... snipped ....
<option value="08">08</option>
<option value="09" selected>09</option>
<option value="10">10</option>
... snipped ....
<option value="22">22</option>
<option value="23">23</option>
</select>
<select name="Time_Minute">
<option value="00">00</option>
<option value="01">01</option>
... snipped ....
<option value="19">19</option>
<option value="20" selected>20</option>
<option value="21">21</option>
... snipped ....
<option value="58">58</option>
<option value="59">59</option>
</select>
<select name="Time_Second">
<option value="00">00</option>
<option value="01">01</option>
... snipped ....
<option value="22">22</option>
<option value="23" selected>23</option>
<option value="24">24</option>
... snipped ....
<option value="58">58</option>
<option value="59">59</option>
</select>
<select name="Time_Meridian">
<option value="am" selected>AM</option>
<option value="pm">PM</option>
</select>

See also $smarty.now, {html_select_date} and the date tips page.





Featured




Featured
PHP Code Examples
web site templates
Learn PHP playing Trivia
PHP & MySQL Forums
Web Development Index

List Your ResourceUpdate Your Resource

Copyright © 2006 - 2008 MickMel Inc