|
Posted by Matthew White on 07/19/07 21:29
"YvesDM" <no@way.invalid.be> wrote in message
news:LROni.5493$kZ1.104551@phobos.telenet-ops.be...
> Hi,
>
> How can I do this,
> I've got a little form with a dropdown.
>
> <select name="maand">
> <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>
>
>
> I would like to select the current month automatically,
> but don't know how to do this?
> I would start like this (I think)
>
> $maand = S_POST["maand"];
> $maandhuidig = date(n);
> if($maandhuidig == $maand){
> echo?....don't know...}
>
> Many tnx
> --
> 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!"
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
Navigation:
[Reply to this message]
|