i have downloaded your coding few hours ago.
but somehow i have some problem there which is the calender just won't come out.
i had follwed the steps and put the coding at the right place but it wont come out.
i need to put a calender in a system which i had build recently.
and also, i have questions about this calender. this basic calender is used only to view the date or we can pick the date and the date choosen will appear/selected in the text field beside the calender?
here's the code. hoping to know the news from you as soon as possible
<?php require_once('Connections/cn.php'); ?>
<?php require_once('Connections/cn.php'); ?>
<?php session_start(); ?>
<?php
//$uname = $_REQUEST['txtuname'];
//$querysearch = ("SELECT StaffID, StaffIC, StaffName FROM staff WHERE StaffIC='.$uname.'");
//$search = mysql_query($querysearch, $cn) or die(mysql_error());
//$totalRows_search = mysql_num_rows($search);
//$rows_search= =mysql_fetch_assoc($search);
/* extract($rows_search);
echo "<tr>";
echo "<td>".$rows_search['StaffID']. "</td>";
echo "<td>".$rows_search['StaffIC']. "</td>";
echo "<td>".$rows_search['StaffName']. "</td>";
echo "</tr>";
*/
//$staffID = $querysearch['StaffID'];
//$staffIC = $querysearch['StaffIC'];
//$staffName = $querysearch['StaffName'];
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form13")) {
$insertSQL = sprintf("INSERT INTO software (IDNo, SName, SPublisher, NoOfCD, Price, Supplier, DateReceived) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['IDNo'], "text"),
GetSQLValueString($_POST['SName'], "text"),
GetSQLValueString($_POST['Spublisher'], "text"),
GetSQLValueString($_POST['NoOfCD'], "int"),
GetSQLValueString($_POST['price'], "int"),
GetSQLValueString($_POST['Supplier'], "text"),
GetSQLValueString($_POST['DateReceived'], "date"));
mysql_select_db($database_cn, $cn);
$Result1 = mysql_query($insertSQL, $cn) or die(mysql_error());
$insertGoTo = "sinvenreqinstall2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_cn, $cn);
$query_Recordset1 = "SELECT * FROM staff";
$Recordset1 = mysql_query($query_Recordset1, $cn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
#Layer20 {
position:absolute;
left:381px;
top:427px;
width:13px;
height:21px;
z-index:20;
}
#Layer21 {
position:absolute;
left:381px;
top:455px;
width:15px;
height:20px;
z-index:21;
}
#Layer22 {
position:absolute;
left:381px;
top:484px;
width:12px;
height:20px;
z-index:22;
}
#Layer23 {
position:absolute;
left:381px;
top:511px;
width:14px;
height:19px;
z-index:23;
}
#Layer24 {
position:absolute;
left:381px;
top:573px;
width:14px;
height:21px;
z-index:24;
}
#Layer25 {
position:absolute;
left:381px;
top:605px;
width:13px;
height:19px;
z-index:25;
}
#Layer26 {
position:absolute;
left:382px;
top:632px;
width:15px;
height:20px;
z-index:26;
}
#Layer2 {
position:absolute;
left:321px;
top:416px;
width:573px;
height:246px;
z-index:36;
}
#Layer3 {
position:absolute;
left:410px;
top:512px;
width:153px;
height:27px;
z-index:37;
}
.style1 {
font-size: 12px;
font-family: Tahoma;
}
-->
</style>
<style type="text/css">
.main {
width:200px;
border:1px solid black;
}
.month {
background-color:black;
font:bold 12px verdana;
color:white;
}
.daysofweek {
background-color:gray;
font:bold 12px verdana;
color:white;
}
.days {
font-size: 12px;
font-family:verdana;
color:black;
background-color: lightyellow;
padding: 2px;
}
.days #today{
font-weight: bold;
color: red;
}
</style>
<script type="text/javascript" src="basiccalendar.js">
/***********************************************
* Basic Calendar-By Brian Gosselin at [url]http://scriptasylum.com/bgaudiodr/[/url]
* Script featured on Dynamic Drive ([url]http://www.dynamicdrive.com[/url])
* This notice must stay intact for use
* Visit [url]http://www.dynamicdrive.com/[/url] for full source code
***********************************************/
function buildCal(m, y, cM, cH, cDW, cD, brdr){
var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];
var dim=[31,0,31,30,31,30,31,31,30,31,30,31];
var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st
oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st
var todaydate=new Date() //DD added
var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added
dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
var t='<div class="'+cM+'"><table class="'+cM+'" cols="7" cellpadding="0" border="'+brdr+'" cellspacing="0"><tr align="center">';
t+='<td colspan="7" align="center" class="'+cH+'">'+mn[m-1]+' - '+y+'</td></tr><tr align="center">';
for(s=0;s<7;s++)t+='<td class="'+cDW+'">'+"SMTWTFS".substr(s,1)+'</td>';
t+='</tr><tr align="center">';
for(i=1;i<=42;i++){
var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : ' ';
if (x==scanfortoday) //DD added
x='<span id="today">'+x+'</span>' //DD added
t+='<td class="'+cD+'">'+x+'</td>';
if(((i)%7==0)&&(i<36))t+='</tr><tr align="center">';
}
return t+='</tr></table></div>';
}
</script>
</head>
<body text="#000000" link="#0000FF" vlink="#FFFFFF" alink="#0000FF">
<div id="Layer1" style="position:absolute; left:111px; top:1px; width:596px; height:157px; z-index:1"><img src="djclub%2Bweb/quaterbodysinvenW.jpg" width="1025" height="900"></div>
<div id="Layer18" style="position:absolute; left:478px; top:345px; width:268px; height:24px; z-index:18">
<div align="center"><font size="3" face="Tahoma"><strong>Add New Software Collection
</strong></font></div>
</div>
<div id="Layer19" style="position:absolute; left:297px; top:298px; width:458px; height:18px; z-index:19"><font color="#FFFFFF" size="2" face="Tahoma"><strong><font color="#006666">Add
New Software</font> :<a href="sinvenreqinstall2.php"> Request Installation</a><a href="sinvenreqinstall.htm"></a>
: <a href="sinvenborrow 2.php">Borrow Software </a>: <a href="sinvensearchicview.php">Report</a> </strong></font></div>
<div id="Layer30" style="position:absolute; left:239px; top:189px; width:91px; height:21px; z-index:30">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23">
<param name="BGCOLOR" value="">
<param name="BASE" value=".">
<param name="movie" value="button14.swf">
<param name="quality" value="high">
<embed src="button14.swf" width="100" height="23" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" base="." ></embed>
</object>
</div>
<div id="Layer31" style="position:absolute; left:239px; top:212px; width:99px; height:30px; z-index:31">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23">
<param name="BGCOLOR" value="">
<param name="BASE" value=".">
<param name="movie" value="button15.swf">
<param name="quality" value="high">
<embed src="button15.swf" width="100" height="23" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" base="." ></embed>
</object>
</div>
<div id="Layer32" style="position:absolute; left:239px; top:236px; width:101px; height:27px; z-index:32">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23">
<param name="BGCOLOR" value="">
<param name="BASE" value=".">
<param name="movie" value="button16.swf">
<param name="quality" value="high">
<embed src="button16.swf" width="100" height="23" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" base="." ></embed>
</object>
</div>
<div id="Layer33" style="position:absolute; left:239px; top:259px; width:98px; height:22px; z-index:33">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23">
<param name="movie" value="button17.swf">
<param name="quality" value="high">
<embed src="button17.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="23" ></embed>
</object>
</div>
<div id="Layer34" style="position:absolute; left:755px; top:297px; width:104px; height:22px; z-index:34">
<form name="form11" method="post" action="sinvensearch.php">
<label>
<input name="txtSearch" type="text" id="txtSearch">
</label>
</form>
</div>
<div id="Layer35" style="position:absolute; left:904px; top:296px; width:75px; height:20px; z-index:35">
<form name="form12" method="post" action="">
<input type="submit" name="Submit2" value="Search">
</form>
</div>
<div id="Layer2">
<form action="<?php echo $editFormAction; ?>" name="form13" method="POST">
<table width="562" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="184" height="26"><font size="2" face="Tahoma">ID No </font></td>
<td width="378"><label>
<input name="IDNo" type="text" id="IDNo" size="45">
</label></td>
</tr>
<tr>
<td height="40"><font size="2" face="Tahoma">Software
Name</font></td>
<td><label>
<textarea name="SName" cols="45" rows="2" id="SName"></textarea>
</label></td>
</tr>
<tr>
<td height="27"><font size="2" face="Tahoma">Software
Publisher</font></td>
<td><label>
<input name="Spublisher" type="text" id="Spublisher" size="45">
</label></td>
</tr>
<tr>
<td height="27"><font size="2" face="Tahoma">Numbers
of CD</font></td>
<td><label>
<input name="NoOfCD" type="text" id="NoOfCD" size="45">
<span class="style1">(ex:1,2,3)</span></label></td>
</tr>
<tr>
<td height="27"><font size="2" face="Tahoma">Price</font></td>
<td><label>
<input name="price" type="text" id="price" size="45">
<span class="style1">(ex:1,2,3)</span></label></td>
</tr>
<tr>
<td height="26"><font size="2" face="Tahoma">Supplier</font></td>
<td><label>
<input name="Supplier" type="text" id="Supplier" size="45">
</label></td>
</tr>
<tr>
<td height="28"><font size="2" face="Tahoma">Date
Received</font></td>
<td><label>
<input name="DateReceived" type="text" id="DateReceived">
<select onChange="updatecalendar(this.options)">
<script type="text/javascript">
var themonths=['January','February','March','April','May','June',
'July','August','September','October','November','December']
var todaydate=new Date()
var curmonth=todaydate.getMonth()+1 //get current month (1-12)
var curyear=todaydate.getFullYear() //get current year
function updatecalendar(theselection){
var themonth=parseInt(theselection[theselection.selectedIndex].value)+1
var calendarstr=buildCal(themonth, curyear, "main", "month", "daysofweek", "days", 0)
if (document.getElementById)
document.getElementById("calendarspace").innerHTML=calendarstr
}
document.write('<option value="'+(curmonth-1)+'" selected="yes">Current Month</option>')
for (i=0; i<12; i++) //display option for 12 months of the year
document.write('<option value="'+i+'">'+themonths[i]+' '+curyear+'</option>')
</script>
</select>
<div id="calendarspace">
<script>
//write out current month's calendar to start
document.write(buildCal(curmonth, curyear, "main", "month", "daysofweek", "days", 0))
</script>
</div></label></td>
</tr>
<tr>
<td> </td>
<td><p> </p>
<p>
<label>
<input type="submit" name="Submit3" value="Add New">
</label>
</p></td>
</tr>
</table>
<p>
<input name="txtuname" type="hidden" id="txtuname" value="<?php echo $uname; ?>">
<input name="staffID" type="hidden" id="staffID" value="<?php echo $staffID; ?>">
<input name="staffIC" type="hidden" id="staffIC" value="<?php echo $staffIC; ?>">
<input name="StaffName" type="hidden" id="StaffName" value="<?php echo $staffName; ?>">
</p>
<p> </p>
<p> </p>
<input type="hidden" name="MM_insert" value="form13">
</form>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>