473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Drop down menus

Hi everybody, I have a little problem with drop down menus. I have a PHP
page in which I extract some categories (from a database). I put those
categories in a drop down menu without problems. I would like that when
a category is chosen, the entire page should be reloaded without the
pression of any "submit" button, and should appear a new drop down menu.
The main problem is the reloading of the page as it appears not to work
if, after OPTION VALUE, I put the name of the same page in which there
is the forum (entrate_in.php). Infact it say "page not found" while it
works perfectly if I put the name of a different php page... how to
resolve this problem?

<?
echo "<tr>";
echo "<td width='20%' bgcolor='#C0C0C0' align='right'> <p
align='right'>Tipo</td>";
echo "<td width='80%'> <select ONCHANGE='location =
this.options[this.selectedIndex].value;' name='tipo' id='tipo'>";

$query = mysql_query("SELECT * FROM categorie ORDER BY categoria");
$numrows = mysql_num_rows($query);

for ($i=0; $i<$numrows; $i++)
{
$row = mysql_fetch_row($query);
list($id, $categ, $col1, $col2, $col3) = $row;
echo "<option value=\"entrate_in.php?Nome=$categ\">$categ</option>";}
echo "</select></td>";
echo "</tr>";?>

THANK YOU!
Jan 15 '06 #1
1 1645
Capitan Catarro wrote:
Hi everybody, I have a little problem with drop down menus. I have a PHP
page in which I extract some categories (from a database). I put those
categories in a drop down menu without problems. I would like that when
a category is chosen, the entire page should be reloaded without the
pression of any "submit" button, and should appear a new drop down menu.
The main problem is the reloading of the page as it appears not to work
if, after OPTION VALUE, I put the name of the same page in which there
is the forum (entrate_in.php). Infact it say "page not found" while it
works perfectly if I put the name of a different php page... how to
resolve this problem?


Post only what the client gets, we can only guess what the result of
your PHP code is.

It is generally a bad idea to use onchange with a select element - in
IE, if you tab to the select then use the down arrow key to select an
option, onchange is fired every time you go to a new option. In the
scenario above, every time the user presses the down arrow to navigate
to the next option down, the page will re-load and they'll be back to
option 1.

Try the demo below.

To reload the current page, modify an attribute of the location object
or call its reload method:

<URL:http://developer.mozilla.org/en/docs/DOM:window.location>
<script type="text/javascript">
function reloadPage(sel)
{
window.location.search = '?' + sel.options[sel.selectedIndex].text;
}
</script>

<form action="">
<select onchange="reloadPage(this);">
<option>Option 1
<option>Option 2
<option>Option 3
</select>
</form>

[...]
--
Rob
Jan 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nanos | last post by:
For the form I need to create drop down select with say five different options. There also should be possibility to enter own option if one is not listed. How can I do it.? Thank you in advance...
3
by: KK | last post by:
Drop-down menus are the hottest thing since Wonder Bread but . . . 1. Alot of people put them in the they-look-nice-but-you-cant-code-them-right-so-they-always-look-messed-up category (a la...
10
by: Haines Brown | last post by:
I've implemented the horizontal drop down menu discussed recently in this newsgroup, and it works nicely under Galeon and Mozilla, but not IE 5.0. Here are the problems: Under IE 5.0, the...
0
by: vikram.cvk | last post by:
Hello Experts, Im trying to design a CSS vertical drop down menu which should have the following functionality. Home About Us | -->Overview
2
by: pantagruel | last post by:
I have an old web application I did where browsers with dynamic capabilities received a drop down menu on the top of the page and a fold out on the left hand side of the page and non-dynamic...
3
by: Andrew | last post by:
Hello, friends, I was asked to implement a .aspx page with drop down menus. When a mouse pointer moves over a menu bar, a drop down list containing sub-menus will show up. Thus a user may select...
1
by: ReGenesis0 | last post by:
I am doing drop-down menus for a site I'm developing (not my idea, neadless to say.) I have a nice robust Javascript that handles it, and it actually WORKS, works across browsers even! How...
1
by: Kaland | last post by:
Do the search engines follow links that are within forms (like the drop-down menu) so that those pages are indexed? Here is the code for a sample drop-down menu that I created. <form><select...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.