WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : reusable date dropdown for use with database or other input
Categories : PHP, Date Time Click here to Update Your Picture
frederic vandenplas
Date : Jul 26th 2005
Grade : 1 of 5 (graded 7 times)
Viewed : 3621
File : No file for this code example.
Images : No Images for this code example.
Search : More code by frederic vandenplas
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<html>
<head>
<title>calendar drop downs for dynamic content</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php /* i made this function for a website where i needed a lot of date entering
All the javascripts i found worked or half or didn' t allow me to 'select' the
drop downs with data from the database or weren't able to accept data from an
external source therefore...
Vandenplas fréderic, belgium, info AT conexxion DOT be

fill the arrays for the different months I still need a way to check if a date entered exists, but that is for later :)

*/

function select_dd($jaar,$maand,$dag){
   
$arrays[1][1]=1;$arrays[1][2]='jan';$arrays[1][3]=31;
   
$arrays[2][1]=2;$arrays[2][2]='feb';$arrays[2][3]=28;
   
$arrays[3][1]=3;$arrays[3][2]='mar';$arrays[3][3]=31;
   
$arrays[4][1]=4;$arrays[4][2]='apr';$arrays[4][3]=30;
   
$arrays[5][1]=5;$arrays[5][2]='mei';$arrays[5][3]=31;
   
$arrays[6][1]=6;$arrays[6][2]='jun';$arrays[6][3]=30;
   
$arrays[7][1]=7;$arrays[7][2]='jul';$arrays[7][3]=31;
   
$arrays[8][1]=8;$arrays[8][2]='aug';$arrays[8][3]=31;
   
$arrays[9][1]=9;$arrays[9][2]='sep';$arrays[9][3]=30;
   
$arrays[10][1]=10;$arrays[10][2]='okt';$arras[10][3]=31;
   
$arrays[11][1]=11;$arrays[11][2]='nov';$arrays[11][3]=30;
   
$arrays[12][1]=12;$arrays[12][2]='dec';$arrays[12][3]=31;
   
$year[1]=2005;$year[2]=2006;$year[3]=2007;
   
/* make the select boxes*/
   
echo '<select name="menu1" >';
    for (
$x=1;$x<=12;$x=$x+1){
        echo
'<option value="'.$arrays[$x][1].'"'. ($arrays[$x][1]==$maand ? "selected" : "");
        echo
'>'.$arrays[$x][2].'</option>';
    }
    echo
'</select>';
    echo
'<select name="menu2" >';
    for (
$x=1;$x<=31;$x=$x+1){
        echo
'<option value="'.$x.'"'. ($arrays[$x][1]==$dag ? "selected" : "");
        echo
'>'.$x.'</option>';
    }
    echo
'</select>';
    echo
'<select name="menu3" >';
    for (
$x=1;$x<=3;$x=$x+1){
        echo
'<option value="'.$year[$x].'"'. ($year[$x]==$jaar ? "selected" : "");
        echo
'>'.$year[$x].'</option>';
    }
    echo
'</select>';
}

/* call the function with a date
or with 3 variables ( $year, $month, $day)
wich shoul come from elsewhere*/
echo select_dd(2006,3,7);
?>
</body>
</html>



A Timing Class
Categories : PHP, PHP Classes, Date Time
Finding the day of the week for a specific date.
Categories : PHP, Databases, MySQL, Date Time
A wrapper function to format dates coming from a databases with the same syntax as PHP's date() function.
Categories : Date Time, Databases, PHP
pcCalendar class - Allows for the creation of calendars in HTML pages. All output functions can be easily overridden, refer to article 1471 for an example.
Categories : PHP, Date Time, Calendar, PHP Classes
A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Categories : PHP, PHP Classes, Calendar, Date Time
PHP Round Clock - Must have Gif support to use this.
Categories : PHP, Date Time, Graphics
A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed.
Categories : Date Time, PHP, Complete Programs, Calendar
Open and Close your website in fixed times .
Categories : PHP, PHP Classes, Cron, Date Time
mysql date/time converters
Categories : PHP, MySQL, Databases, Date Time
Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used.
Categories : HTML and PHP, PHP, Date Time
If you want to create select buttons featuring current date this example will show you how...
Categories : Date Time, HTML and PHP, PHP
Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example.
Categories : PHP, Date Time, PHP Classes, Calendar
calculus of the eastersunday
Categories : BC math, PHP, Date Time, Databases
Functions used to define a schedule of holidays. Can define non-fixed holidays (eg. 3rd sunday of June).
Categories : Calendar, Date Time, PHP
Monthly and Daily Upcoming Events calendar.
Categories : Date Time, PostgreSQL, PHP, Calendar, Databases