You can manipulate many variables in the function.
By : cds4654
/*Displays out date variables in three select boxes inside a <td></td>*/
<?php
print "<html>";
print "<body>";
print "<table>";
print "<tr>";
get_dates("2","left", "000000", "From", "nm_f", "nd_f", "ny_f");
print "</tr>";
print "</table>";
print "</body>";
print "</html>";
?>
<?php
function get_dates($col="", $ali="", $color="", $f_t="", $nm_f="", $nd_f="", $ny_f="")
{
if (empty($nm_f)){$nm_f.="month_f";}
if (empty($nd_f)){$nd_f.="date_f";}
if (empty($ny_f)){$ny_f.="year_f";}
$months = array("January","February","March","April","May","June","July",
"August","September","October","November","December");
print "<td align=\"$ali\" colspan=\"$col\">";
print "<font color=\"#$color\"><b>$f_t: </b></font>";
//print "</td>";
//print "<td>";
print "<select name=\"$nm_f\"";
for ($x_f=0; $x_f<=count($months); $x_f++)
{
print "\t<option value=\"$x_f\">".$months[$x_f-1]."\n";
reset($months);
}
print "</select>";
//print "</td>";
//print "<td>";
print "<select name=\"$nd_f\"";
for ($d_f=0; $d_f<32; $d_f++)
{
print "\t<option value=\"$d_f\">".$d_f."\n";
}
print "</select>";
//print "</td>";
//print "<td>";
print "<select name=\"$ny_f\"";
for ($y_f=1999; $y_f<2016; $y_f++)
{
print "\t<option value=\"$y_f\">".$y_f."\n";
}
print "</select>";
print "</td>";
}
?>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Date Time Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects. FREE! Go There Now!
|
|
|
|
Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications. FREE! Go There Now!
|
|
|
|
As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br /> FREE! Go There Now!
|
|
|
|
Ken Krugler, co-founder of code search company Krugle, and Laura Merling, vice president of Marketing and Business Development for Krugle, join to talk about the ins and outs of code search and what it means as a new feature for developerWorks users. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
|
|
|
|
Join this webcast to discover the key requirements for successful change and release management. Learn how to extend your .NET environment to improve productivity and collaboration, and address core problems afflicting team development. In this webcast, we’ll review typical challenges faced by customers and how to resolve them with the IBM Rational Change and Release Management solution, including Rational ClearCase, Rational ClearQuest and Rational Build Forge. Replay is available for 9 months. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to try the IBM SOA Sandbox for connectivity. The SOA Sandbox for connectivity provides a trial environment with the tooling and components to help you explore how to effectively connect your infrastructure and integrate all of the people, processes and information in your company. Use the hosted sandbox to explore SOA techniques that streamline connecting existing IT assets together, as well as learn how to connect them to new business logic. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |