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

how to get item name in combo or list box from its index using php.here i try in js

but this doesn't give answer....
Expand|Select|Wrap|Line Numbers
  1. function fun_month()
  2. {
  3. var temp = document.getElementById("list_month").selectedIndex;
  4. alert(temp);
  5.  
  6. selected_month = document.getElementById("list_month").options[temp].value;
  7.  
  8. alert(selected_month);
  9. }
  10.  
Apr 8 '12 #1

✓ answered by johny10151981

in a combo box there is two thing
1. the value and
2. the text
Expand|Select|Wrap|Line Numbers
  1. <select id='dd'>
  2.  <option value='1'>111</option>
  3.  <option value='2'>222</option>
  4. </select>
  5.  
if you do
document.getElementById('dd').value
you would get either 1 or 2.

your form would send the value of selected item to server.

3 1973
Rabbit
12,516 Expert Mod 8TB
Why are you giving us javascript if you're trying to do it in PHP? Where's your PHP code?

Just so you know, you can't really do this in PHP. But why would you want to? What's the point of passing the selected index to PHP when you can just pass the selected value?
Apr 8 '12 #2
johny10151981
1,059 1GB
in a combo box there is two thing
1. the value and
2. the text
Expand|Select|Wrap|Line Numbers
  1. <select id='dd'>
  2.  <option value='1'>111</option>
  3.  <option value='2'>222</option>
  4. </select>
  5.  
if you do
document.getElementById('dd').value
you would get either 1 or 2.

your form would send the value of selected item to server.
Apr 9 '12 #3
i want to get value so i try to get index and then by using that index i want to get a value so only i raise a question..
johny give a exact answer for that thanks...
but using index too, i get value..
but johny method is simple..
Apr 14 '12 #4

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

Similar topics

25
by: skull | last post by:
Hi everybody, it is my first post in this newsgroup. I am a newbie for python though I have several years development experience in c++. recently, I was stumped when I tried to del item of a list...
5
by: Joe Fallon | last post by:
I have a list box with 7 text values in it. I have a pair of buttons to Move Up or Move Down the selected item one position. What is the simplest way to code the buttons so the item moves one...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
10
by: tkpmep | last post by:
For any list x, x.index(item) returns the index of the FIRST occurrence of the item in x. Is there a simple way to identify the LAST occurrence of an item in a list? My solution feels complex -...
3
by: Riccardo Murri | last post by:
Hello, I have some code that stops when trying to find a graph in a list of similar graphs:: (Pydb) list 110 try: 111 canonical = self.base 112 except ValueError: 113 ...
2
by: Steve | last post by:
I am working on a program that works like a check in/check out system. There is a folder on a network drive that stores a bunch of vb programs. This program will check in and check out programs...
4
by: mistyblu | last post by:
I wrote an Access97 application using VBA for a company many moons ago and they have approximately 20 users. All has been hunky dory for a long time but suddenly they have a combo box error on 3 of...
5
by: Mr.SpOOn | last post by:
Hi, is there any way to search elements in a list using wildcards? I have a list of various elements and I need to search for elements starting with 'no', extract them and put in a new list. I...
2
by: aberry | last post by:
Hi all, In my script , I need to get name of list Im using eg. sat I have following list ... mca = Now I want to get name of the list i.e. just 'mca'. Do anyone know any method/attribute...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.