Re: <OPTION

From: Date: Thu, 26 Oct 2006 17:14:35 +0000
Subject: Re: <OPTION
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-243681@lists.php.net to get a copy of this message
On Thu, 2006-10-26 at 11:43 -0500, Richard Lynch wrote: > > $last_day = 31; //calculated from date()/mktime() etc > for ($day = 1; $day <= $last_day; $day++){ > $selected = $chosen_day == $ ? 'selected="selected"' : ''; > echo " <option $selected>$day</option>\n"; > } > > I don't *think* the w3c requires/recommends a value= in there, if the > label *IS* the value, but can live with it either way... > echo " <option value=\"$day\" $selected>$day</option>\n"; > is fine. >From the XHTML standard: http://www.w3.org/TR/html/#diffs We read the following: XML does not support attribute minimization. Attribute-value pairs must be written in full. Attribute names such as compact and checked cannot occur in elements without their value being specified. CORRECT: unminimized attributes <dl compact="compact"> INCORRECT: minimized attributes <dl compact> So even if you aren't using XHTML yet, it's wise to get into the practice. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#243681) next »