I need a calander codes for reservation purposes
Posted: Mon Mar 09, 2009 6:51 pm
Moved by moderator from Job Hunt to PHP - Code. Please pay attention to what forum you are posting in. Thank you.
Hi
I'm Implementing a hotel reservasion software.I'm new to the PHP.I need a drop down menu calander for the reservation purposes.if some body got any coding for this help me please.I have got a sample coding it's gives some error message if somebody can rectify it please check it.so I can modify the codes for my purposes.
calander:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Calander</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
include("date_pulldown.php");
$date1 = new date_pulldown("fromdate");
$date2 = new date_pulldown("todate");
$date3 = new date_pulldown("foundingdate");
$date3->setYearStart(1971);
if(empty($_REQUEST['foundingdate'])){
$date3->setDate_array( array('mday'=>26,'mon'=>4,'year'=>1984));
}
?>
<body>
<form action="<?php echo $PHP_INFO ?>" method="post">
<p>
</br>
<tr>
<td>from: </td>
<td> <select name="from" size="0">
<option value="None"> <?php print $date1-> output( );?>
</select>
</td>
</tr>
</p>
<p>
to:</br>
<?php print $date2-> output( );?>
</p>
<p>
company founded:</br>
<?php print $date3 -> output( );?>
</p>
<p>
<input type="submit" value="do it"/>
</p>
</form>
</body>
</html>
pulldown class:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Calander</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
class date_pulldown{
private $name;
private $timestamp = -1;
private $months = array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
private $yearstart = -1;
private $yearend = -1;
function _construct($name){
$this->name = $name;
}
}
function setDate_request(){
if(! $this->setDate_array($_REQUEST[$this->name])){
return $this->setDate_timestamp(time());
}
return true;
}
function setDate_timestamp($time){
return $this->timestamp = $time;
return true;
}
function setDate_array($inputdate){
if( is_array($inputdate) &&
isset($inputdate['mon']) &&
isset($inputdate['mday'])&&
isset($inputdate['year'])){ $this->timestamp = mktime(11,59,59,$inputdate['mday'],$inputdate['year']);
return true;
}
return false;
}
array('mday'=>5, 'mon'=>7,'year'=>1999 );
getdate(931172399);
function setYearStart($year){
$this->yearstart = $year;
}
function setYearEnd($year){
$this->yearend = $year;
}
function getYearStart(){
if ($this->yearstart < 0){
$nowarray = getdate(time ());
$this->yearstrat = $nowarray['year']-5;
}
return $this->yearstart;
}
function getYearEnd(){
if ($this->yearend < 0){
$nowarray = getdate(time ());
$this->yearend = $nowarray['year']+5;
}
return $this->yearend;
}
function output( ){
if ($this->timestamp <0 ){
$this->setDate_request();
}
$datearray = getdate($this->timestamp);
$out=$this->day_select($this->name,$datearray);
$out=$this->month_select($this->name,$datearray);
$out=$this->year_select($this->name,$datearray);
return $out;
}
function day_select($fieldname,$datearray){
$out = "<select name=\"$fieldname"."[mday]\">\n";
for($x=1;$x<=31;$x++){
$selected = ($datearray['mday']==($x)? 'selected = "selected"':'');
$out .= "<option value=\"$x\"$selected>" .sprintf("%02d",$x);
$out .="</option>\n";
}
$out .="</select>\n";
return $out;
}
function month_select($fieldname,$datearray){
$out = "<select name=\"$fieldname"."[mon]\">\n";
for($x=1;$x<=12;$x++){
$selected = ($datearray['mon']==($x)? 'selected = "selected"':'');
$out .= "<option value=\"$x\"$selected>" .$this->month[$x-1];
$out .="</option>\n";
}
$out .="</select>\n";
return $out;
}
function year_select($fieldname,$datearray){
$out = "<select name=\"$fieldname"."[year]\">";
$start = $this->getYearStart();
$end = $this->getYearEnd();
for($x=$start;$x<=$end;$x++){
$selected = ($datearray['year']==($x)? 'selected = "selected"':'');
$out .= "<option value=\"$x";
$out .="</option>\n";
}
$out .="</select>\n";
return $out;
}
?>
</body>
</html>
Hi
I'm Implementing a hotel reservasion software.I'm new to the PHP.I need a drop down menu calander for the reservation purposes.if some body got any coding for this help me please.I have got a sample coding it's gives some error message if somebody can rectify it please check it.so I can modify the codes for my purposes.
calander:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Calander</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
include("date_pulldown.php");
$date1 = new date_pulldown("fromdate");
$date2 = new date_pulldown("todate");
$date3 = new date_pulldown("foundingdate");
$date3->setYearStart(1971);
if(empty($_REQUEST['foundingdate'])){
$date3->setDate_array( array('mday'=>26,'mon'=>4,'year'=>1984));
}
?>
<body>
<form action="<?php echo $PHP_INFO ?>" method="post">
<p>
</br>
<tr>
<td>from: </td>
<td> <select name="from" size="0">
<option value="None"> <?php print $date1-> output( );?>
</select>
</td>
</tr>
</p>
<p>
to:</br>
<?php print $date2-> output( );?>
</p>
<p>
company founded:</br>
<?php print $date3 -> output( );?>
</p>
<p>
<input type="submit" value="do it"/>
</p>
</form>
</body>
</html>
pulldown class:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Calander</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
class date_pulldown{
private $name;
private $timestamp = -1;
private $months = array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
private $yearstart = -1;
private $yearend = -1;
function _construct($name){
$this->name = $name;
}
}
function setDate_request(){
if(! $this->setDate_array($_REQUEST[$this->name])){
return $this->setDate_timestamp(time());
}
return true;
}
function setDate_timestamp($time){
return $this->timestamp = $time;
return true;
}
function setDate_array($inputdate){
if( is_array($inputdate) &&
isset($inputdate['mon']) &&
isset($inputdate['mday'])&&
isset($inputdate['year'])){ $this->timestamp = mktime(11,59,59,$inputdate['mday'],$inputdate['year']);
return true;
}
return false;
}
array('mday'=>5, 'mon'=>7,'year'=>1999 );
getdate(931172399);
function setYearStart($year){
$this->yearstart = $year;
}
function setYearEnd($year){
$this->yearend = $year;
}
function getYearStart(){
if ($this->yearstart < 0){
$nowarray = getdate(time ());
$this->yearstrat = $nowarray['year']-5;
}
return $this->yearstart;
}
function getYearEnd(){
if ($this->yearend < 0){
$nowarray = getdate(time ());
$this->yearend = $nowarray['year']+5;
}
return $this->yearend;
}
function output( ){
if ($this->timestamp <0 ){
$this->setDate_request();
}
$datearray = getdate($this->timestamp);
$out=$this->day_select($this->name,$datearray);
$out=$this->month_select($this->name,$datearray);
$out=$this->year_select($this->name,$datearray);
return $out;
}
function day_select($fieldname,$datearray){
$out = "<select name=\"$fieldname"."[mday]\">\n";
for($x=1;$x<=31;$x++){
$selected = ($datearray['mday']==($x)? 'selected = "selected"':'');
$out .= "<option value=\"$x\"$selected>" .sprintf("%02d",$x);
$out .="</option>\n";
}
$out .="</select>\n";
return $out;
}
function month_select($fieldname,$datearray){
$out = "<select name=\"$fieldname"."[mon]\">\n";
for($x=1;$x<=12;$x++){
$selected = ($datearray['mon']==($x)? 'selected = "selected"':'');
$out .= "<option value=\"$x\"$selected>" .$this->month[$x-1];
$out .="</option>\n";
}
$out .="</select>\n";
return $out;
}
function year_select($fieldname,$datearray){
$out = "<select name=\"$fieldname"."[year]\">";
$start = $this->getYearStart();
$end = $this->getYearEnd();
for($x=$start;$x<=$end;$x++){
$selected = ($datearray['year']==($x)? 'selected = "selected"':'');
$out .= "<option value=\"$x";
$out .="</option>\n";
}
$out .="</select>\n";
return $out;
}
?>
</body>
</html>