View Full Version : Absolute beginner looking for some drop-down help.

07-24-2012, 07:50 PM
Hi folks, I literally started using dreamweaver yesterday. My previous experience is a VERY limited amount of messing around with Frontpage etc.

Anyway, I've been messing around with making a new website to totally upgrade my current one (Dreamweaver really opened my eyes to the possibilities). I've been ticking along quite nicely, lots of googling, lots of reading, etc but getting there regardless. I'm absolutely stumped with my current issue though.....

I have a database with 2 tables in it. The first table has only 1 column with categories in it. The 2nd table has 4 columns (ID, category, pic_url, thumb_url). I have made a VERY simple page with only a populated dropdown and I'm attempting to create dynamic links. The dropdown is populated via a recordset from the "Category" table.

What I'm looking for is that when I click on a category from the drop down, I want all the records from the other table with the same category to be listed below it. I can't for the life of me figure out how to do this.

The dropdown is called "menu"
I have a recordset with the Categorys (menu1)
I have a recordset with the other info (main1)
The dropdown is populated dynamically (menu)
Underneath I have dynamic text (main1.pic_url)

The dynamic text is set as a repeater to list all records that match the query.

Now, the trouble I seem to be having is getting the form to activate when I change the dropdown. I currently have...

<select name="menu" id="menu" onChange="document.forms(0).submit()">

On the form I have

<form id="form1" name="form1" method="post" action="Untitled-1.php">

Untitled as I'm just testing to get it to work lol.

I thought this, along with what I have done under the main recordset (see below) would have had it running no bother but I'm so new to this I really have no idea what I'm doing so I'm basically winging it lol.

The "Main" recordset has the following....

SELECT pic_cat, pic_url, pic_thumb
FROM mkivpics
WHERE pic_cat = menu

Where the variable is "menu", "Text", "-1", "$_POST['menu']

I thought this would take the value from the dropdown called menu and query it against the database but absolutely nothing happens when I select anything.

Sorry for the long post, I wanted to give as much detail as I could to what I was doing.



07-25-2012, 06:22 AM
I've managed to get this working on a VERY limited capacity.

What I did was use "onchange" to run a small script....

function bob(){
var menu1 = document.form1.menu.value;
location.href="Mess1.php? menu1=" + menu1;

The only issue is that as soon as I reload the page the menu reverts back to its default setting (as would be expected). If I select the same value from the menu twice though, it sticks.... so I know it works.

Is there any way that I can get the query to run without reloading the page?

I feel as if I'm so near yet so far lol.

Any help would be greatly appreciated.


07-25-2012, 07:05 PM
Nevermind. I managed to fumble through it.