Create a Time-Sensitive Form in PHP

Description

The following code shows how to create a Time-Sensitive Form.

Example


<?/*from  w w  w  .j av  a 2s  .co  m*/
<FORM ACTION="index.php" METHOD=GET>
<INPUT TYPE="hidden" NAME="time" VALUE="<?php echo time(); ?>">
Enter your message (5 minute time limit):<INPUT TYPE="text" NAME="mytext" VALUE="">
<INPUT TYPE="submit" Value="Send Data">
</FORM>

if($_GET['time']+300 >= time()) {
     echo "You took too long!<BR>";
     exit;
}
?>

The code above generates the following result.

Create a Time-Sensitive Form in PHP




















Home »
  PHP Tutorial »
    Form »




PHP Form
Form Demo