Media Informasi

Media Informasi harian terkini

  • Home
Home » PHP » Script Source Code Tanggal New Event PHP

Script Source Code Tanggal New Event PHP

  aditya    
<?php
$m = (!$m) ? date("m",mktime()) : "$m";
$y = (!$y) ? date("Y",mktime()) : "$y";

if ($_SERVER['REQUEST_METHOD'] == "POST") 
{
$eventdate = $_POST['eventdate']; 
$event = $_POST['event']; 
echo "<br />";

echo "<h2>PHP Event Calendar</h2>";
echo "This is a demo. We are not saving the event to the calendar, but you could.<br /><br />";
echo "We are demo-ing building the calendar, and interacting with it.<br /><br />";
echo "<b>Event:</b> $event<br />";
echo "<b>Date:</b> $eventdate<br />";
exit();
}

?>
<html>
<head>
<title>PHP Event Calendar</title>
</head>
<body bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC">

<h2>PHP Event Calendar</h2>

<blockquote>
<table>
<tr>
<td valign="top"><?php mk_drawCalendar($_GET['m'],$_GET['y']); ?></td>
<td width="25" nowrap><br /></td>

<form name="f" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#000000"><tr><td>
<table cellpadding="4" cellspacing="1" border="0 "bgcolor="#FFFFFF">
<tr><td colspan="2" bgcolor="#000000"><font size="+1" color="#FFFFFF"><b>Add New Event</b></font></td></tr>
<tr><td><b>Event Date: </b></td><td><input type="text" name="eventdate" value="" size="12"> <font size="2">mm/dd/yyyy</font></td></tr>
<tr><td><b>Event:</b></td><td><input type="text" name="event" size="35" maxlength="128"></td></tr>
<tr><td colspan="2" align="center" bgcolor="#CCCCCC"><input type="submit" value="Add Event"></td></tr>
</table></td></tr></table></form>

</td>
</tr></table>
</blockquote>
</body>
</html>


<?php

//*********************************************************
// DRAW CALENDAR
//*********************************************************
/*
Draws out a calendar (in html) of the month/year
passed to it date passed in format mm-dd-yyyy 
*/
function mk_drawCalendar($m,$y)
{
if ((!$m) || (!$y))
{ 
$m = date("m",mktime());
$y = date("Y",mktime());
}

/*== get what weekday the first is on ==*/
$tmpd = getdate(mktime(0,0,0,$m,1,$y));
$month = $tmpd["month"]; 
$firstwday= $tmpd["wday"];

$lastday = mk_getLastDayofMonth($m,$y);

?>
<table cellpadding="2" cellspacing="0" border="1">
<tr><td colspan="7" bgcolor="#CCCCDD">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><th width="20"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>">&lt;&lt;</a></th>
<th><font size=2><?="$month $y"?></font></th>
<th width="20"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m+1)>12) ? 1 : $m+1 ?>&y=<?=(($m+1)>12) ? $y+1 : $y ?>">&gt;&gt;</a></th>
</tr></table>
</td></tr>

<tr><th width=22 class="tcell">Su</th><th width=22 class="tcell">M</th>
<th width=22 class="tcell">T </th><th width=22 class="tcell">W</th>
<th width=22 class="tcell">Th</th><th width=22 class="tcell">F</th>
<th width=22 class="tcell">Sa</th></tr>

<?php $d = 1;
$wday = $firstwday;
$firstweek = true;

/*== loop through all the days of the month ==*/
while ( $d <= $lastday) 
{

/*== set up blank days for first week ==*/
if ($firstweek) {
echo "<tr>";
for ($i=1; $i<=$firstwday; $i++) 
{ echo "<td><font size=2>&nbsp;</font></td>"; }
$firstweek = false;
}

/*== Sunday start week with <tr> ==*/
if ($wday==0) { echo "<tr>"; }

/*== check for event ==*/ 
echo "<td class='tcell'>";
echo "<a href=\"#\" onClick=\"document.f.eventdate.value='$m-$d-$y';\">$d</a>";
echo "</td>\n";

/*== Saturday end week with </tr> ==*/
if ($wday==6) { echo "</tr>\n"; }

$wday++;
$wday = $wday % 7;
$d++;
}
?>

</tr></table>
Click on a date to select it and to populate the event date field on the left
<br />

<?php
/*== end drawCalendar function ==*/
} 




/*== get the last day of the month ==*/
function mk_getLastDayofMonth($mon,$year)
{
for ($tday=28; $tday <= 31; $tday++) 
{
$tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
if ($tdate["mon"] != $mon) 
{ break; }

}
$tday--;

return $tday;
}

?>
Label: PHP

Arsip Blog

Popular Posts

  • Contoh soal dan pembahasan Kalkulus 1 Integral
  • Membuat Login Form dengan PHP [Level Multi User]
  • Vocaloid 2 Hatsune Miku Full [Free Download]
  • Cara Import Database Ke Phpmyadmin yang File Nya *.opt *.frm *.MYD *.MYI
  • Cara Membuat Program Olah Data Sederhana menggunakan Netbean
  • Cara Menggunakan SSH di Android
  • Tutorial Mencari BUGS Host , Website , Server
  • Resident Evil 6 (2013) Full Version Pc Game Download Full Crack Patch iso
  • After "Submit", redirect back to previous page php
  • Buat text bergerak segala arah

Label

  • Trik (49)
  • software (49)
  • Info (47)
  • PHP (47)
  • tutorial (27)
  • Website (24)
  • Belajar (23)
  • Java (12)
  • Algoritma (11)
  • games (11)
  • Teknologi (9)
  • SEO (8)
  • berita (8)
  • film (8)
  • Design (6)
  • database (5)
  • promo (2)

Pengunjung

About

SEO Starter is SEO and Mobile Friendy Blogger Template. Responsive Sesuai dengan Rekomendasi Google

Web Links

  • Blogger Platform
  • CMS WordPress
  • Facebook
  • Microblogging
  • Manchester United

Follow by Email

Subsribe to get post update from this blog in your email inbox.

Copyright © Media Informasi. All rights reserved. Template by Romeltea Media