RE: [PHP] New way to make select boxes auto select
| From: | Johnson, Kirk | Date: | Thu, 25 Jul 2002 17:48:06 +0000 |
| Subject: | RE: [PHP] New way to make select boxes auto select | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109558@lists.php.net to get a copy of this message | ||
Nathan, this is a new idea to me and very interesting. Do you know what
happens here if the error reporting is set to max? Are a bunch of
"unitialized variables" warnings issued?
Thanks for contributing this to the list.
Kirk
> -----Original Message-----
> From: Nathan Cook [mailto:ncook@pcsedu.com]
> Sent: Thursday, July 25, 2002 10:34 AM
> To: Php List
> Cc: David Chase
> Subject: [PHP] New way to make select boxes auto select
>
>
> You may already be doing it like this, but I think I found a
> new way to
> make select boxes auto-select (what data they put in) a lot
> easier. All you
> have to do is put a variable in each select tag that is equal
> to the value
> of the select option i.e.: <option value=teacher $teacher> --
> then all you
> have to do is base the variable on that <select
> name=interest> $$interest =
> "selected"; quick and easy with out having to loop through an
> if elseif
> statement. Let me know if you like that method or have any
> objections.
>
> Full example below.
>
> print("<select name=interest>\n");
> // creates a variable with a name based on
> // the value of interest with a value of "selected"
> $$interest = "selected";
> print("<option value=>- Select One -</option>\n");
> print("<option value=teacher $teacher>Teacher</option>\n");
> print("<option value=lego $lego>Lego Enthusiast</option>\n");
> print("<option value=ymca $ymva>YMCA</option>\n");
> print("</select> \n");