Page 1 of 1

Drop down menus and page refreshes

Posted: Thu Jun 10, 2010 10:40 pm
by markosjal
I have been beating my head against the wall to get some understanding of using drop down menus for two purposes on the same page

1) the 1st drop down simply loads a different page when one makes a selection . I have tried various pieces of code and no luck yet Some that others have said in some forums works, does not work for me at least unless I am a larger idiot than I had thought


3) the second drop down should define a variable that the rest of the page will use to detrrmine files and paths . The choices are as simple as "Category 1" selecting "1" and "category 2" selecting "2" . I then use this variable to fill out the remaining part of the p[age. Here is one question that I have since I have had no code that yet works , can I predefine that variable or make the rest of the page a If, else statement in other words if no selection was yet made , the rest of the page will not load?? If I do not do that then the page must refresh once the selection is made so it loads the correct images and text, based on the variable selected in 2 above.

Thanks

Mark

Re: Drop down menus and page refreshes

Posted: Sun Jun 13, 2010 11:45 pm
by markosjal
I answered my own question. I found this very useful and perfect solution for what I was looking for. Just a drop down and no GO button! I am also able to show the current location in the drop down after it is selected based on php variables. note the first option .

Code: Select all

<FORM>
<SELECT ONCHANGE="location = this.options[this.selectedIndex].value;">
<option value="<?php echo $PHP_SELF;?>"><?php echo $abutadcatnum;?></option>
<option value="/admin/buttonads.php?addom=<?php echo $addom; ?>&abutadcatnum=-1">-1 123</option>
<option value="/admin/buttonads.php?addom=<?php echo $addom; ?>&abutadcatnum=2">2 ABC</option>
<option value="/admin/buttonads.php?addom=<?php echo $addom; ?>&abutadcatnum=3">3  XYZ</option>
<option value="/admin/buttonads.php?addom=<?php echo $addom; ?>&abutadcatnum=4">4 foo</option>
<option value="/admin/buttonads.php?addom=<?php echo $addom; ?>&abutadcatnum=5">5 sball</option>>
</SELECT>
</FORM>
{/code]