G'day
I am using php to check user input and therefore require a "value" in the form fields (eg value="<?php echo $newDate ?>"). Obviously, $newDate has a null value until a user enters one. So I get the following error: "Error: there is no attribute value for this element (in this HTML version)" Can anyone suggest a work around to this, or perhaps suggest what I'm doing wrong.
Can't help you with the PHP, but select elements do not have a value attribute. Values for these go in the option elements. When the form is submitted, the selected option(s) value(s) are passed to the form processing script.
You don't even need to specify the value in the options unless what you want to pass is different from what you want to display:
<select name="newDate"> <option value="">Date</option> <option>1</option> <option>2</option> <option>3</option> <!-- etc --> </select>
If your script needs to pre-set a specific option, you will need to get it to add: selected="selected" to the appropriate option (in the example below, option "2" is selected)
<select name="newDate"> <option value="">Date</option> <option>1</option> <option selected="selected">2</option> <option>3</option> <!-- etc --> </select>
Can't tell you HOW to do that in PHP because I don't "speak" PHP and it would be off-topic for this list.
HTH -- Bert Doorn, Better Web Design http://www.betterwebdesign.com.au/ Fast-loading, user-friendly websites
****************************************************** The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************
