Login   Register  
PHP Classes
elePHPant
Icontem

File: example2.phtml

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Slava Ivanov  >  Date & Time  >  example2.phtml  >  Download  
File: example2.phtml
Role: Example script
Content type: text/plain
Description: Example use two objects on a form
Class: Date & Time
Class to manipulate date and time on a form
Author: By
Last change:
Date: 2002-10-17 21:33
Size: 1,816 bytes
 

Contents

Class file image Download
<?
// This is an example of PHP script using DATETIME class.

include("datetimeclass.inc");

$oidissued = new DATETIME();
$oidissued->set_datename("idissued_m""idissued_d""idissued_y");
$oidissued->set_datetime_byglobal("HTTP_POST_VARS");

$oidexpired = new DATETIME();
$oidexpired->set_datename("idexpired_m""idexpired_d""idexpired_y");
$oidexpired->set_datetime_byglobal("HTTP_POST_VARS");


?>
<h2>DATETIME class example</h2>

<form name="testdate" method="post" action="<? echo $GLOBALS["SCRIPT_NAME"?>">
<?
// print information about date entered
if ($oidissued->get_date_error() || $oidexpired->get_date_error())
    echo 
"<p><b><font color=red>".$oidissued->get_date_error().$oidexpired->get_date_error()."</font></b>";
else {
    echo 
"<p><b>Issued Date:</b>";
    echo 
"<br><b>You have entered: ".$oidissued->get_date_entered()."</b>";
    echo 
"<br><b>Timestamp: ".$oidissued->get_timestamp_entered()."</b> ----> ".date("F j, Y"$oidissued->get_timestamp_entered());
    echo 
"<p><b>Expiry Date:</b>";
    echo 
"<br><b>You have entered: ".$oidexpired->get_date_entered()."</b>";
    echo 
"<br><b>Timestamp: ".$oidexpired->get_timestamp_entered()."</b> ----> ".date("F j, Y"$oidexpired->get_timestamp_entered());
}


// draw select on the form
echo "<p>";
echo 
"<p>Issued Date:";
echo 
$oidissued->get_select_months(1"sword""month")." ";
echo 
$oidissued->get_select_days(1"day")." ";
echo 
$oidissued->get_select_years("ldigit", (int)date("Y"), ((int)date("Y") - 10), "year");

echo 
"<p>Expiry Date:";
echo 
$oidexpired->get_select_months(1"sword""month")." ";
echo 
$oidexpired->get_select_days(1"day")." ";
echo 
$oidexpired->get_select_years("ldigit", (int)date("Y"), ((int)date("Y") + 30), "year");
?>
<br><br>
<input type="submit" value="Let's GO" name="go">