Solved

Help Creating a Dynamic Drop Down menu using PHP and Dreamweaver

Posted on 2007-11-15
6
1,685 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

737 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