Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of FergoFrog  >  Validate-Calculate Age  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: Validate-Calculate Age
Validate dates and calculate relative age
Author: By
Last change: Changed email address
Date: 5 years ago
Size: 1,512 bytes
 

Contents

Class file image Download
<?php
/*
Validate-Calculate Age Class by FergoFrog
Copyright (C) 2009 FergoFrog

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-
1307, USA.

Contact:
Email: projects@fergofrog.com
Web: http://www.fergofrog.com/ or http://projects.fergofrog.com/
*/

//Here is a simple form for calculating your age, using the VCAge class
    
if ($_POST['bday']&&$_POST['bmonth']&&$_POST['byear'])
    {
        include 
"vcage.class.php";
        
$VCAge = new VCAge();
        
        
$bday $_POST['bday'];
        
$bmonth $_POST['bmonth'];
        
$byear $_POST['byear'];
        
        echo 
$VCAge->V_CAge($bday$bmonth$byear);
    }
    else
    {
        echo <<<EOL
        DDMMYYYY<form action="?" method="post"><input type="text" name="bday" size="2" maxlenght="2" /><input type="text" name="bmonth" size="2" maxlenght="2" /><input type="text" name="byear" size="4" maxlenght="4" /><input type="submit" /></form>
EOL;
    }
?>