| 
	
 | 
 Posted by YvesDM on 07/19/07 22:37 
Matthew White wrote: 
  
> The option tag has an attribute of selected.  This needs to be set as 
> "yes" 
> for it to be the selected option.  I would make the months/numbers an 
> array, 
> and then use a while loop to echo them all out.  Then, if the month is the 
> current month, add the option tag with the selected="yes" attribute. 
>  
> Matt 
 
Hi Matt tnx for your answer. 
I already resolved this. 
My solution is not 100% clean, but it does what I want :-)  
I just an extra option on top of the list which has the selected tag  
and always takes the value of the current month ;-)  
 
As simple as this:  
 
$monthnow = date("n"); 
echo <<<EOM 
<html> 
<form method="post"> 
<table> 
 <select name="maand"> 
               <option value='$monthnow'selected>Current month</option> 
               <option value='1'>januari</option> 
               <option value='2'>februari</option> 
               <option value='3'>maart</option> 
               <option value='4'>april</option> 
               <option value='5'>mei</option> 
               <option value='6'>juni</option> 
               <option value='7'>juli</option> 
               <option value='8'>augustus</option> 
               <option value='9'>september</option> 
               <option value='10'>oktober</option> 
               <option value='11'>november</option> 
               <option value='12'>december</option> 
                </select> 
 
 
Kind regards, 
Yves 
--  
Running GNU/Linux 
yvesdm[AT]telenet[dot]be | GnuPG: 0xD590F022  
Jabber: yvesdm[AT]jabber.belnet.be 
"If windows is the solution, plz give me the problem back!"
 
  
Navigation:
[Reply to this message] 
 |