simple in PHP
<pre>
<select name="cc_year" id="cc_year">
<?php
$year = date('Y');
for ($i=$year;$i <= $year+10;$i += 1)
{
$two_digit_year = substr($i,2,2);
if ($i == $year) {
echo "<option value=\"{$two_digit_year}\" selected>{$i}</
option>";
} else {
echo "<option value=\"{$two_digit_year}\">{$i}</option>";
}
}
?>
</select>
</pre>
On Dec 4, 2009, at 4:54 PM, Dan Stein wrote:
So I need to generate for credit cards a dynamic year drop down
using javascript or php.
I want the available years to be just the current year and x years
out.
Does anyone have code they would be willing to share?
This is easy in witango. But not an option for this project.
--
Dan Stein MSN
Digital Software Solutions
[email protected]
www.dss-db.com
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
Ben Johansen
http://www.webspinr.com
[email protected]
Phone: 360-597-3372
Mobile: 360-600-7775
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf