PDA

View Full Version : Form Submission Cut-off Time??


pacgal
01-09-2007, 07:43 AM
I am setting up a form site which allows users to place bids on items coming up for an auction. I know how to post the server time on the page, but I need to know if it is possible to set-up the form so once a pre-determined date and time has passed the user will be redirected to a different page.

Example:

Cut-off time: Tuesday January 9th 6pm

User 1 fills out a form at 5pm and is directed to "success page"

User 2 fills out a form a 6:15pm and is directed to a "Sorry its to late. Please Call" page.

Any ideas would be helpful.

-pacgal

saravan
01-09-2007, 09:22 AM
Use mk_time() function.
That would be helpful. This function will return you the current time & date. When tha page loads the current time is calculated using mk_time(). Compares the current time with the already stored time.

This way may be helpful for you.

rafiki
01-09-2007, 10:59 AM
<?php
$subdate = "01-01-2007";
$realdate = "date(d-m-Y)";
$subtime = mk_time(); // time of sumbition or use $_SERVER['REQUEST_TIME'] if php version > 5.1
if($subtime < 6.00||1800) // set latest time for last submits
{
header(Location:http://www.site.com/pageok.php); //redirect to page if they submit in time
}
elseif($subtime >= 6.00||1800) // if they click submit after 6
{
echo "Sorry too late, Submition is now over"; // tell them they are too late
}
else
{
echo "Sorry an error occured"; // use this for bugs or errors
}

I think this is pretty much right. Although im not to sure on the format of time
you also need to add an if statement for date checking.
hope this helps :)