Hi
ALL
This is a code.....given below
<select name="year" >
<option value="1">2001</option>
<option value="2">2002</option>
<option value="3">2003</option>
<option value="4">2004</option>
<option value="5">2005</option>
<option value="6">2006</option>
<option value="7">2007</option>
</select>
I need a suggestion using PHP code that will select 2001 ,or 2002 not 1, 2 as value when i will select the dropdown..
Thanks
Basudeb
Drop down select using PHP
Moderator: General Moderators
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: Drop down select using PHP
Well you could simply change the value attribute to suit (value="2001" etc) or you could hold the alternate values in an array:
Ensuring that the index starts at one. Personally, I would go for the former method over the latter.
Code: Select all
$yearValues = array(1 => 2001, 2002, 2003, 2004, 2005);