Re: Dropdowns
| From: | Eric McKeown | Date: | Fri, 02 Jun 2000 19:33:07 +0000 |
| Subject: | Re: Dropdowns | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-919@lists.php.net to get a copy of this message | ||
Maxwell Hung wrote:
> your html is wrong, when you use the option tag you
> need a value for the option then a title for it. A bit
> like an <a > tag.
The VALUE attribute is optional. You can write OPTION tags with or
without
the VALUE attribute, and if you leave it off, the value of the selected
option will be that which follows the OPTION tag and precedes the
beginning
of the next OPTION tag. For instance....
<SELECT NAME="bogus">
<OPTION>Option 1
<OPTION>Option 2
</SELECT>
In this case, if the user selects the first option, the value of $bogus
on
the next page will be "Option 1", and if he selects the second option,
it
will be "Option 2". Closing the <OPTION> tag is optional with every
browser I've ever worked with, which admittedly is not all of them.
>
>
> mysql_fetch_array also returns an array of your
> results so calling $publication will not print the
> results that you want.
I'm in agreement on this point. You need to extract the individual
pieces
of the array instead of just trying to print out the array as a whole.
I think fixing this ought to fix the problem entirely.
My $0.02.
Eric
>
>
> try this: I always select the db before so you will
> need to mod that bit.
>
> echo "<select name=\"publication\">\n";
> $query = mysql_query("SELECT str_publication FROM
> publication");
> while ($result= mysql_fetch_array($query)) {
> echo "<option value=\"" .
> $result["str_publication"]
> . "\">" . $result["str_publication"] .
> "</option>\n";
> }
> echo "</select>\n";
>
> The new line will only make a difference if you view
> the source it will have no effect on what you see in
> your browser.
>
> M@
>