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 : enhanced date picker with jcript checking for a dynamic date input
Categories : PHP, Java Script, Date Time, Calendar, Arrays Click here to Update Your Picture
frederic vandenplas
Date : Jul 29th 2005
Grade : 2 of 5 (graded 9 times)
Viewed : 7907
File : 4203.php
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 >
<script type="text/javascript">
<!-- Begin
<!-- This script is made for a website where a begin and end day has to be
<!-- inserted. As it's to heavy to have a refill of the dropdownboxes to check
<!-- for the the number of days in the dropdown boxes I choose for checking on
<!-- the result of the input and not on the input itself.
<!-- i choose for three input boxes instead of one field to make computation
<!-- easier afterwards. All remarks are welcom as this is my first J scrip :)

function confirmFunction() {


var menu1_inhoud,menu2_inhoud,jaar,schrikkeljaar,feb_dagen,vol_datum,vol_datumb;
var menu1_inhoudb,menu2_inhoudb,jaarb,schrikkeljaarb,feb_dagen;

var message="";

menu1_inhoud=document.form1.menu1.value;
menu2_inhoud=document.form1.menu2.value;
menu1_inhoudb=document.form1.menu1b.value;
menu2_inhoudb=document.form1.menu2b.value;
jaar=document.form1.menu3.value;
schrikkeljaar= eval(jaar % 4);
if(schrikkeljaar==0){
feb_dagen=29;
}else{
feb_dagen=28;
}
jaarb=document.form1.menu3b.value;
schrikkeljaar= eval(jaarb % 4);
if(schrikkeljaar==0){
feb_dagen=29;
}else{
feb_dagen=28;
}



if ((menu1_inhoud==4|menu1_inhoud==6|menu1_inhoud==9|menu1_inhoud==11) && menu2_inhoud >30){
                message="In deze maand zijn er maar 30 dagen ! ";
                message="There are only 30 days in this month";
                 alert(message);
                 }
if ((menu1_inhoud==2) && menu2_inhoud>feb_dagen){
                message="In februari zijn er maar "+feb_dagen+" dagen ! ";
                message="In februari are only "+feb_dagen+" days ! ";
                 alert(message);
                 }
if ((menu1_inhoudb==4|menu1_inhoudb==6|menu1_inhoudb==9|menu1_inhoudb==11) && menu2_inhoudb >30){
                message="In deze maand zijn er maar 30 dagen ! ";
                message="There are only 30 days in this month";
                 alert(message);
                 }
if ((menu1_inhoudb==2) && menu2_inhoudb>feb_dagen){
                message="In februari zijn er maar "+feb_dagen+" dagen ! ";
                message="In februari are only "+feb_dagen+" days ! ";
                 alert(message);
                 }
vol_datum=jaar;
vol_datum += (menu1_inhoud<10) ? "0"+menu1_inhoud : menu1_inhoud;
vol_datum += (menu2_inhoud<10) ? "0"+menu2_inhoud : menu2_inhoud;
vol_datumb=jaarb;
vol_datumb += (menu1_inhoudb<10) ? "0"+menu1_inhoudb : menu1_inhoudb;
vol_datumb += (menu2_inhoudb<10) ? "0"+menu2_inhoudb : menu2_inhoudb;
if (eval(vol_datumb)<eval(vol_datum)){
                message="De tweede datum kan NIET kleiner zijn dan de eerste !";
                message="The second date cannot be less than the first date !";
                 alert(message);
                 }
}
// End -->
</script>
<?php /* 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 :)

*/?>

<?php
echo '<form action="" method="get" name="form1"><Table>';

function select_dd($jaar,$maand,$dag,$jaarb,$maandb,$dagb){
if (!isset($dagb) | !isset($maandb) | !isset($jaarb)){
        $jaarb=$jaar;$maandb=$maand;$dagb=$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;$year[4]=2008;
/* make the select boxes*/
echo '<tr>';
echo '<td><select id= "menu1" name="menu1" onChange="confirmFunction()">';
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></td>';
echo '<td><select name="menu2" onChange="confirmFunction()">';
for ($x=1;$x<=31;$x=$x+1){
echo '<option value="'.$x.'"'.
($x==$dag ? "selected" : "");
echo '>'.$x.'</option>';
}
echo '</select></td>';
echo '<td><select name="menu3" onChange="confirmFunction()">';
for ($x=1;$x<=4;$x=$x+1){
echo '<option value="'.$year[$x].'"'.
($year[$x]==$jaar ? "selected" : "");
echo '>'.$year[$x].'</option>';
}
echo '</select></td></tr>';

/* de tweede dropdownbox*/
echo '<tr><td><select id= "menu1b" name="menu1b" onChange="confirmFunction()">';
for ($x=1;$x<=12;$x=$x+1){
echo '<option value="'.$arrays[$x][1].'"'.
($arrays[$x][1]==$maandb ? "selected" : "");
echo '>'.$arrays[$x][2].'</option>';
}
echo '</select></td>';
echo '<td><select id= "menu2b" name="menu2b" onChange="confirmFunction()">';
for ($x=1;$x<=31;$x=$x+1){
echo '<option value="'.$x.'"'.
($x==$dagb ? "selected" : "");
echo '>'.$x.'</option>';
}
echo '</select></td>';
echo '<td><select id= "menu3b" name="menu3b" onChange="confirmFunction()">';
for ($x=1;$x<=4;$x=$x+1){
echo '<option value="'.$year[$x].'"'.
($year[$x]==$jaarb ? "selected" : "");
echo '>'.$year[$x].'</option>';
}
echo '</select></td></tr>';
}
/* call the function with a date
or with 6 variables ( $year, $month, $day)
wich should come from elsewhere*/
echo select_dd(2005,2,28,NULL,NULL,NULL);

?>
</form>



</body>
</html>



Calendars to choose a range of dates , reservation events ...
Categories : PHP, Calendar, Java Script, Date Time
PHP Calendar
Categories : PHP, Calendar, Date Time, Java Script, CSS
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 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
Array values from javascript to php
Categories : PHP, Java Script, Arrays
Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example.
Categories : PHP, Date Time, PHP Classes, Calendar
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
CALENDAR - easy calendar-navigation with PHP
Categories : PHP, Date Time, HTML and PHP, Calendar
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
This script contains 2 functions: 1 to create html select object based on your own customer date format entry- "M d Y h:i.... etc". The second function processes the select object on submit back to unix time.
Categories : PHP, Calendar, Date Time, HTML and PHP
Shows the current time as a PNG-image. This script does not use the GD library. You can use it as a benchmark (because it's slow), or as a quick reference for implementing a simple PNG-file generator.
Categories : Graphics, Zlib, Calendar, PHP, Date Time
Local Time clock and Server time usign PHP and JavaScript
Categories : PHP, Java Script, Date Time, Beginner Guides
Javascript Date Picker
Categories : Java Script, Date Time, Calendar
Calendar, Kalender, date, time, day, month, year
Categories : PHP, Date Time, Calendar