Re: combo box validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2010-06-07 at 13:49 -0400, David Mehler wrote:

> Hello,
> I've got a form with two combo boxes, one for the month one for the
> day. Both are required. I've got code that checks the post submission
> to ensure neither is empty. My problem is that if a user does not
> select anything in the combo boxes January first is sent, this i don't
> want. If they haven't selected anything i'd like that to show as an
> error.
> Thanks.
> Dave.
> 


Make the first item in the select list something like this:

<option value="0" selected="selected">-- select month --</option>

Then just check for the 0 value in PHP when the form is submitted.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux