Drop Down Menu
Posted: Sat Apr 20, 2002 9:11 am
Hi,
i have created a drop down menu script which at the moment displays the results of just one coloumn within one of my database tables. How can i modify the script to display more than 1 coloumn, i.e. 4?
The code currently looks like this
I'd like to display column names module_1, module_2.....module_4
I would obviously include the required modules in my SELECT statement, but im unsure as to how to reshape my existing code in the dropdown section.
I understand that it is good practice to create a separate table for such issues within my database, but this example is a special circumstance in which i have to preserve this structure.
Another quick question associated with this as well, assuming that i have 'two' drop down menus, both passing variables of 'different' values. i.e. one is echoing the column name MODULE_TITLE and the other dropdown echoing the coloumn names MODULE_1, MODULE_2, ....MODULE_4. In my INSERT statment, is there any sytax that i can use to INSERT any of the above variables into 'ONE' coloumn name? for example in pesudo code - insert into module_title VALUES module_title OR MODULE_1 or MODULE_2....MODULE_4
Your suggestions and questions are welcome and appreciated
Thank you
-Abi
i have created a drop down menu script which at the moment displays the results of just one coloumn within one of my database tables. How can i modify the script to display more than 1 coloumn, i.e. 4?
The code currently looks like this
Code: Select all
$query = mysql_query("select * module_1 from module_table WHERE user_id='$myvar' ");
while($rows = @mysql_fetch_array($query)) {
echo "<option value="$rowsїmodule_1]">$rowsїmodule_1]</option>I would obviously include the required modules in my SELECT statement, but im unsure as to how to reshape my existing code in the dropdown section.
Code: Select all
echo "<option value="$rowsїmodule_1]">$rowsїmodule_1]</option>Another quick question associated with this as well, assuming that i have 'two' drop down menus, both passing variables of 'different' values. i.e. one is echoing the column name MODULE_TITLE and the other dropdown echoing the coloumn names MODULE_1, MODULE_2, ....MODULE_4. In my INSERT statment, is there any sytax that i can use to INSERT any of the above variables into 'ONE' coloumn name? for example in pesudo code - insert into module_title VALUES module_title OR MODULE_1 or MODULE_2....MODULE_4
Your suggestions and questions are welcome and appreciated
Thank you
-Abi