05-05-2009, 08:32 PM
|
#2 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by xxtokerxx
Hope you can help me on this one,
I want to create a drop down list (1 field) which ties into a database(SQL?) essentially this is the HTML variation of what I have but I want the site to be more dynamic.
<form name="nav">
<select style=
"font-size:12px;
color:#006699;
font-family:verdana;
background-color:#ffffff;
" name="menu" onChange="location=document.nav.menu.options[document.nav.menu.selectedIndex].value;">
<option value=''>Please choose</option>
<option value="test1.html">test1</option>
<option value="test2.html">test2</option>
<option value="test3.html">test3</option>
</select>
</form>
When the user clicks on test1 they are taking to test1.html
Essentially, I want the drop down to "autoselect" the fields from the database so all the options are available without addition of hard coding.
and then require the contents of this "entry" to display on the website.
Any ideas?
BTW I am not too good with sql, php etc. just learning
|
Yeah just use a loop to display your database results.
Code:
Ex:
(your SQL query)
while($rows = mysql_fetch_array($results)) {
echo "<OPTIONS value=\"$page_index\">$page_name</OPTIONS>";
}
|
|
|
|