Online
 
Friday, 05 December 2008
 
 

Bobs-Date-Calculator | Print |  E-Mail
 

<?
/*
There is no header information for this script. You can change everything. You can distribute the script or even sell it.
However, I would appreciate a link to http://www.bannerlessfreewebhosting.com/bobs-scripts/
*/

if ($submit == 'Compute') {
    if ($compute == 'sub') {
        $day = $day - $days;
    } elseif ($compute == 'add') {
        $day = $day + $days;
    }
    $echo = date($output, mktime (0,0,0,$month,$day,$year)); //This is the computed date
}


echo " <form action=\"\" method=post>
<table border=0 cellspacing=1 cellpadding=2 bgcolor=blue width=300>
<tr>
<td bgcolor=blue><font color=white face=arial><B>Compute date"; if (!empty($echo)) {echo " - Result: $echo";} echo "</B></font></td>
</tr>
<tr>
<td bgcolor=white>
    <table border=0 cellpadding=3 cellspacing=0>
    <tr>
        <td aligin=left><font color=blue face=arial>Chose date:  </font></td><td aligin=left><select name=month>";
        getoption(1, 12, date("m"));
        echo "</select><select name=day>";
        getoption(1, 31, date("d"));
        echo "</select><select name=year>";
        getoption(1970, 2020, date("Y"));
        echo "</select></td>
    </tr>
    <tr>
        <td aligin=left><font color=blue face=arial>Add/substract  </font></td><td aligin=left><select name=compute><option value=add>+<option value=sub>-</select>
    <input type=text name=days size=4 maxlength=4><font color=blue face=arial> day(s)</font></td>
    </tr>
    <tr>
        <td aligin=left><font color=blue face=arial>Output format:  </font></td><td aligin=left><select name=output><option value=\"m-d-Y\">mm-dd-YYYY<option value=\"l, M d Y\">weekday, mm dd yyyyy</select></td>
    </tr>
     
    <tr>
        <td aligin=left colspan=2><input type=submit name=submit value=Compute></td>
    </tr>
     </table>
   
   
</td></tr></table></form>";





function getoption($start, $end, $if) {
    for ($i=$start;$i<=$end;$i++) {
        echo "<option value=$i"; if ($i == $if) { echo " selected";} echo ">$i";
    }
}

?>


This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 4000
 Notify me of follow-up comments
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

Jumbo Coklat
 
Top! Top!