Php > HTML and Php
This PHP function creates dropdown select lists for time and date that you can
This PHP function creates dropdown select lists for time and date that you can change, outputs a 14 char MySQL timestamp in a text field Enjoy this - I'm sure it could be more elegant, but I couldn't find something like this anywhere else. Pull your hair out on more important programming problems! If you like it, or improve upon it, drop me a line. call the function like this: \n"; echo "function adj_timestamp () {\n"; echo "var each_field = new Array(" . count($names) . ");\n"; for ($i=0;$i
\n"; // this creates the selects and add the JS event handler for ($i=0;$i
\n"; $this_one = ${"$names[$i]" . "_range"}; for ($k=0;$k<$this_one[1];$k++) { $each_val = $this_one[0]+$k; if (strlen($each_val)<2) { $each_val = sprintf("%02d", $each_val); } if (${"$names[$i]"}==$each_val) { $selected=" selected"; } else { $selected=""; } echo "
$each_val
\n"; } echo "\n"; } //this creates the initial timestamp $the_stamp = $year . $month . $day . $hour . $minute . $second; //this holds the dynamic timestamp value, make it hidden once you get the hang of how it all works echo "
\n"; } ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage