PHP Code Help?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adilmarwat2004
Forum Commoner
Posts: 44
Joined: Fri Sep 04, 2009 11:28 pm

PHP Code Help?

Post by adilmarwat2004 »

<?php

$currentDate = date("");

$expiry_date = date('14-03-2010');

if($currentDate <= $expiry_date) {
echo '<a href="apply.php">Apply Online</a>';
}
else echo 'Apply Closed';
?>

Problem is that when I change my system date to i.e 18-03-2010 it does not disply
'Apply Closed'.

please help so solve my code?

Adil
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: PHP Code Help?

Post by mikosiko »

Code: Select all

 
<?php
 
$currentDate = date(""); 
[color=#FF0000]*** INSERT an echo "current date: ".$currentDate HERE and look for what are you getting **[/color]
$expiry_date = date('14-03-2010');
 
if($currentDate <= $expiry_date) {
echo '<a href="apply.php">Apply Online</a>';
}
else echo 'Apply Closed';
?>
 
and then.. look here http://php.net/manual/en/function.date.php
Post Reply