I am a little stuck here how to write a code for current date of the server and validate them.
So basically on one file is the form.php and i have to write the code for current date of the server in dd/mm/yy and this can be edited by the user. The date should appear in a form format for example on the web browser should appear date: [23/9/2012].
and on the other file which is the process.php I have to validate the date.
so for my form.php this is what i wrote so far:
<html>
<body>
<?php
if (isset ($_POST["date"])){
$date = date("d/m/y"($_POST["date"]));
echo $date;
}
?>
<form action="form.php" method="POST">
Date: <input type="text" name="date" value="Date" />
</form>
</body>
</html>
what it appear on the web browser for date is only date:[date] just the word date but not the date. I’ve been stuck for an hour for this.
You can do this with a regex:
How the regex works:
DD/MM/YYYY:
DD must be 1-31, MM 1-12 and YYYY a 4 digit num.
Edit: Fixed the problem with February.