On 07/06/10 18:49, David Mehler wrote:
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

It's not really php, but if you make the default option of each combo return an empty value then you can assume that the user didn't choose anything and flag the error:


<select name='month'>
        <option selected='selected' value=''>Select One</option>
        <option value='january'>January</option>

You should find that if the empty option is selected the PHP will not receive a value in $_REQUEST['month'], or at least it will be something equivalent to NULL.

Peter Ford, Developer                 phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd.                              www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to