| Onochie Anyanetu 2007-03-16, 6:58 pm |
| solved.
Thanks Dan, this was pretty much the solution I came up with. Thank you
Gunawan for the idea that got the ball rolling as well
Onochie
On 3/16/07, Dan Shirah <mrsquash2@gmail.com> wrote:
>
> Try something like this:
>
> ****Your query here to get your dropdown values****
> **
> *// This first option value will set your default dropdown to display as
> blank*
> echo "<OPTION value=\"\">--SELECT--</OPTION>\n";
>
> *// This will create a loop to return each option of your dropdown*
> foreach ($query_result as $q)
> {
> *// This if statement says that IF the value in your database matches your
> $_POST(selected) value then mark it as SELECTED*
> if ($q['my_column_value'] == $_POST['my_selected_value'])
> echo "<OPTION value=\"{$q['my_column_value']}\"
> SELECTED>{$q['my_column_value']}</OPTION>\n";
> *// This else statement will return your default(unselected) dropdown list
> if it can't match the selected value with a value in your database*
> else
> echo "<OPTION
> value=\"{$q['my_column_value']}\">{$q['my_column_value']}</OPTION>\n";
> }
>
> Hope that helps.
>
> On 3/16/07, Onochie Anyanetu <ubernoch@gmail.com> wrote:
>
>
|