note 24471 added to function.date

From: Date: Sat, 17 Aug 2002 06:03:36 +0000
Subject: note 24471 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-35165@lists.php.net to get a copy of this message
I found that heaps of payment gateways were harking it when you give them a year with no leading '0'.. + you dont want to put a static list in your form.. so I wrote this little thingy to do years.. <select name="card_expiry_year"> <? //generate years.. $i = date('y'); $z = $i; while( $z < ($i+8)) { if (($z > $i) & ($z < 10)) $z = "0".$z; ?> <option><?=$z;?></option> <? $z++; } ?> </select> Probably badly written but hopefully useful.. -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+24471 http://master.php.net/manage/user-notes.php?action=delete+24471 http://master.php.net/manage/user-notes.php?action=reject+24471

« previous php.notes (#35165) next »