redarrow Posted July 20, 2006 Share Posted July 20, 2006 I want to be able to click the date and then that date goes in the database can you advise me please cheers.[code]<?phpclass calendar{ var $dayofWeek; //Day of week var $day; //day var $mon; //month var $monthShort; var $yr; //Year var $lastMonth; //Last Month var $nextMonth; //NextMonth var $lastYear; //Last year var $nextYear; //Next Year var $nextYearday; // Next year for making day links var $daysInMonth; //Number of days in a month var $firstDayofMonth; //First day of month var $Off; function func_SetOtherLinks($mon){ if ($mon <= 1) { $this->lastMonth = "12"; $this->nextMonth = "02"; $this->lastYear = $this->yr - 1; $this->nextYear = $this->yr; } else if ($mon >= 12) { $this->lastMonth = "11"; $this->nextMonth = "01"; $this->lastYear = $this->yr; $this->nextYear = $this->yr +1; } else { $this->lastMonth = $this->mon -1; if (strlen($this->lastMonth) == 1) { $this->lastMonth = "0" .$this->lastMonth; } $this->nextMonth = $this->mon +1; if (strlen($this->nextMonth) == 1) { $this->nextMonth = "0" .$this->nextMonth; } $this->lastYear = $this->yr; $this->nextYear = $this->yr; }} function calendar($day, $mon, $yr){ $this->day = $day; $this->mon = $mon; $this->yr = $yr; $this->nextYearday = $yr; $arrMonths = array(1 => "January","February","March","April","May","June","July","August","September","October","November","December"); $this->dayofWeek = date("w",mktime(0,0,0,$this->mon,$this->day,$this->yr)); $this->daysInMonth = date("t",mktime(0,0,0,$this->mon,$this->day,$this->yr)); $this->firstDayofMonth = date("w",mktime(0,0,0,$this->mon,1,$this->yr)); for ($i=1 ; $i<=$this->daysInMonth ; $i++){ $final[$i-1 + $this->firstDayofMonth] = date("d",mktime(0,0,0,$this->mon,$i,$this->yr)); } $this->Off = $final; $this->func_MonthShort($this->mon);$this->longNameMonth = $arrMonths[$this->monthShort];$this->func_SetOtherLinks($this->mon);}function func_MonthShort($mon){ if (substr($mon,0,1) == 0) { $this->monthShort = substr($mon,1,1); } else { $this->monthShort = $mon; }} function func_Show(){ $final = $this->Off; $yr = $this->nextYear - 1; echo "<table border=0 cellpadding=2 cellspacing=1>\n"; echo " <td><a href='?day=01&mon=".$this->lastMonth."&yr=".$this->lastYear."'><<</a></td>\n"; echo " <td colspan='5'><p align='center'>".$this->longNameMonth ." " .$this->yr ."</p></td>\n"; echo " <td><a href='?day=01&mon=".$this->nextMonth."&yr=".$this->nextYear."'>>></a></td>\n"; echo " </tr>\n"; echo " <td>S</td>\n"; echo " <td>M</td>\n"; echo " <td>T</td>\n"; echo " <td>W</td>\n"; echo " <td>T</td>\n"; echo " <td>F</td>\n"; echo " <td>S</td>\n"; echo " </tr>\n"; echo " <td ".$this->func_DayLink($final[0]); echo " <td ".$this->func_DayLink($final[1]); echo " <td ".$this->func_DayLink($final[2]); echo " <td ".$this->func_DayLink($final[3]); echo " <td ".$this->func_DayLink($final[4]); echo " <td ".$this->func_DayLink($final[5]); echo " <td ".$this->func_DayLink($final[6]); echo " </tr>\n"; echo " <td ".$this->func_DayLink($final[7]); echo " <td ".$this->func_DayLink($final[8]); echo " <td ".$this->func_DayLink($final[9]); echo " <td ".$this->func_DayLink($final[10]); echo " <td ".$this->func_DayLink($final[11]); echo " <td ".$this->func_DayLink($final[12]); echo " <td ".$this->func_DayLink($final[13]); echo " </tr>\n"; echo " <td ".$this->func_DayLink($final[14]); echo " <td ".$this->func_DayLink($final[15]); echo " <td ".$this->func_DayLink($final[16]); echo " <td ".$this->func_DayLink($final[17]); echo " <td ".$this->func_DayLink($final[18]); echo " <td ".$this->func_DayLink($final[19]); echo " <td ".$this->func_DayLink($final[20]); echo " </tr>\n"; echo " <td ".$this->func_DayLink($final[21]); echo " <td ".$this->func_DayLink($final[22]); echo " <td ".$this->func_DayLink($final[23]); echo " <td ".$this->func_DayLink($final[24]); echo " <td ".$this->func_DayLink($final[25]); echo " <td ".$this->func_DayLink($final[26]); echo " <td ".$this->func_DayLink($final[27]); echo " </tr>\n"; echo " <td ".$this->func_DayLink($final[28]); echo " <td ".$this->func_DayLink($final[29]); echo " <td ".$this->func_DayLink($final[30]); echo " <td ".$this->func_DayLink($final[31]); echo " <td ".$this->func_DayLink($final[32]); echo " <td ".$this->func_DayLink($final[33]); echo " <td ".$this->func_DayLink($final[34]); echo " </tr>\n"; echo " <td ".$this->func_DayLink($final[35]); echo " <td ".$this->func_DayLink($final[36]); echo " <td ".$this->func_DayLink($final[37]); echo " <td ".$this->func_DayLink($final[38]); echo " <td ".$this->func_DayLink($final[39]); echo " <td ".$this->func_DayLink($final[40]); echo " <td ".$this->func_DayLink($final[41]); echo " </tr>\n"; echo "</table>\n";} function func_DayLink($var){ return "bgcolor='#D7EFF1'><a href='?day=$var&mon=$this->mon&yr=$this->nextYearday'>$var</a></td>\n"; }}?>[/code] Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 20, 2006 Share Posted July 20, 2006 If you don't get a usable response to your class question, you can always use a simple javascript date-picker. My favourite is http://www.rainforestnet.com/datetimepicker.htm - simple, effective, and user-proof :) Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 20, 2006 Author Share Posted July 20, 2006 cheers andy but want it in php then iframe it.the problam is that iam relly scared javasript turned off can you help cheers theo Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 20, 2006 Share Posted July 20, 2006 I posted that link in case nobody came up with the answer.Classes aren't something I use (ooh, shame on me), but at first glance this line from the func_DayLink fucntion look like it could be changed from:[code]<a href='?day=$var&mon=$this->mon&yr=$this->nextYearday'>$var</a>[/code]to:[code]<a href='put_this_in_database.php?day=$var&mon=$this->mon&yr=$this->nextYearday'>$var</a>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.