473,378 Members | 1,401 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,378 software developers and data experts.

Dynamic Dropdown

I have created a dynamic drop down menu which ha worked very well. How can i resubmit whatever single thing i select back to a different table in the same database like i would in a mere html drop-down menu.
Nov 29 '11 #1
1 1284
johny10151981
1,059 1GB
If you want to select a specific item in a drop down list you will have to draw it like below:
Expand|Select|Wrap|Line Numbers
  1. <SELECT>
    <OPTION value='a'>a</option>
    <OPTION value='b' SELECTED>b</option>
    <OPTION value='c'>c</option>
    <SELECT>
  2.  
if you want to do it in php, it can be like this
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  $selected='b';
  3.  $arr[0]='a';
  4.  $arr[1]='b';
  5.  $arr[2]='c';
  6. ?>
  7.  <SELECT>
  8. <?php
  9.  for($i=0;i<3;i++)
  10.  {
  11.   if($arr[i]==$selected) 
  12.    $sel='SELECTED';
  13.   else $sel='';
  14.  ?>
  15.   <OPTION value='<?=$arr[$i]?>' <?=$sel?>><?=$arr[$i]?></OPTION>
  16.  <?php
  17.  } 
  18. ?>
  19.  </SELECT>
  20.  
Nov 30 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Andrea Bampi | last post by:
I'm just trying to do my first experiments with js, but I need some good examples to start with.. I need to design a dynamic form with two dropdown menus picking their select values from a db: my...
8
by: Drew | last post by:
I am trying to build a small app that shows a Course Title from the database, then displays a dropdown full of categories for the user to choose one... I thought a loop would be the best way to...
7
by: Jeff Uchtman | last post by:
I know I have done this but my mind is fried. I have a dynamic dropdown in a form. I need to pull both the dynamic dropdown's ID and name listed in the dropdown. Need a little help with grey...
7
by: Bertman105 | last post by:
Hey all, Heres the situation: I have a form page that needs to have multiple drop down menus that is pulling their options from a database. Right now I have one working out of 3. So that is one...
0
by: Just Me | last post by:
My Dynamic dropdown menus are appearing above the text below. How can I prevent this, I have tried setting the zorder high for them, but it makes not difference. Cheers
7
by: Simon Gare | last post by:
Hi, have form on asp page that recalls data from the recordset and populates all the fields except the dynamic dropdown box that doesn't, just shows default value. How do I make it populate...
3
by: d1156676 | last post by:
Hi I have a Dynamic dropdown reading in data from a MySql database, I need to refresh the dropdown when the database is updated without refreshing the whole page. I have had a go at trying to...
10
by: divyac | last post by:
Using javascript i have created dynamic fields in a form with an "add" button.If i press "add" button the fields get repeated. Now my problem is that,after entering the values in the form,the...
2
by: raamay | last post by:
I want to have a dynamic dropdown box whose entries would depend on the selection of an entry in the first dropdown box. BUT the second dropdown box should not reload, only the entries inside should...
1
by: sydd | last post by:
Hi, I was wondering if it's possible to create a dynamic dropdown menu from this code. if($rs->getNumRows() > 0){ $intProjectCount = 1; $htmlOut ="<table width='100%' border='0'...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.