Solved

Help Creating a Dynamic Drop Down menu using PHP and Dreamweaver

Posted on 2007-11-15
6
1,684 Views
Last Modified: 2012-06-27
Hello
I need help building Dynamic Drop Down menu.

Here is the code for the menu:
==========
<form name="form1">
      <select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
        <option value="">Please Choose One</option>
        <?php
do {  
?>
        <option value="<?php echo $row_rsPlaceAll['id_plc']?>"><?php echo $row_rsPlaceAll['placebg_plc']?></option>
        <?php
} while ($row_rsPlaceAll = mysql_fetch_assoc($rsPlaceAll));
  $rows = mysql_num_rows($rsPlaceAll);
  if($rows > 0) {
      mysql_data_seek($rsPlaceAll, 0);
        $row_rsPlaceAll = mysql_fetch_assoc($rsPlaceAll);
  }
?>
      </select>
    </form>
===================
The menu actually display all values from the recorset but values are not linkable.
I need them to go to detailed page something like:
places.php?place=<?php echo $row_rsPlaceAll['placebg_plc']; ?>
0
Comment
Question by:mianet
  • 3
  • 3
6 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 200 total points
ID: 20294467
Hi mianet,

What happens when you put:

places.php?place=<?php echo $row_rsPlaceAll['placebg_plc']; ?>

in the value of the select?
0
 

Author Comment

by:mianet
ID: 20294598
Hi jason1178,

I've tried this but nothing happens.
I suppose that I have to use java script - something similar to this solution: http://www.experts-exchange.com/Web_Development/Software/Macromedia_Dreamweaver/Q_21305272.html?sfQueryTermInfo=1+dynam+jump+menu+php

but I can now quite understand this
0
 

Author Comment

by:mianet
ID: 20294623
.....can not quite understand this
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 20296131
You don't need to use javascript, but you should.  What part of the above link do you not understand?
0
 

Author Comment

by:mianet
ID: 20296367
Hi jason,
actually it is working now - I've put

places.php?place=<?php echo $row_rsPlaceAll['placebg_plc']; ?>

in the value of the select  and use this java script.

Could you please brief explain me why i should use the java script and how can i do it without this script

Thanks!
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 20296518
>> Could you please brief explain me why i should use the javascript and how can i do it without this script

It's easier to take these in reverse order.  You can use the get method for forms to set the query string.  So your form action would point to places.php and then change the name of the select to place.  Using the menu and submitting would result in this url:

places.php?place=(whatever value chosen)

The problem with this method and the reason to use javascript is that the GET method is inviting a PHP injection attack unless you take steps to ensure that values fed to your page through the query string are cleansed of malicious code.  To avoid this, stick with the javascript.



0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
problems with mysql ODBC Connector and vbscript 4 39
Currency in SQL? 2 32
reverse engineer .sql from php files 11 35
Use Select Query to Return Results as a Form 9 24
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question