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

Multiple selection using php w/ javascript

2
I hope someone can help here;
I have two lists, with multiple selection, say one is employees and the other is called members, when names are moved from employees into the other list box they become members of a team.
the names of these members are to be inserted into the database, my problem is that the members are supposed to be stored in a javascript array and read by the php script to be saved in the database, when this is done only the first element of the array is saved.....Please help;
Thanks
May 20 '07 #1
2 1499
pbmods
5,821 Expert 4TB
Heya, NourB. Welcome to TSDN!

the names of these members are to be inserted into the database, my problem is that the members are supposed to be stored in a javascript array and read by the php script to be saved in the database, when this is done only the first element of the array is saved.....Please help;
Thanks
Set the name of your select to "varname[]" (note the brackets):

Expand|Select|Wrap|Line Numbers
  1. <select name="mySet[]" multiple="multiple">
  2.     <option value="1">one</option>
  3.     etc.
  4. </select>
  5.  
For a working example, take a look at this page.
May 21 '07 #2
NourB
2
Greetings;
Thanks for the help, but thats not quite what i'm looking for.
Inorder to move the names between the two lists i use a javascript function, after that i want to save the content of the second list in the db, but since its more than one item i would need to put them into an array....
here is a snippet of the code
Expand|Select|Wrap|Line Numbers
  1.  
  2.  <select size=8 name=employees  style='width: 250;' dir=rtl multiple='yes'>
  3.                     <option value=0></option>
  4.                     </select>
  5.                     </td>
  6.                     <td bgcolor=$color4 align=center>
  7.                     <input type=button value='>'  name=1 style='width: 70;' onclick='return nameXchange(document.meetings_frm.employees,document.meetings_frm.members[]);' ><br>
  8.                     <input type=button value='<'  name=1 style='width: 70;' onclick='return nameXchange(document.meetings_frm.members[],document.meetings_frm.employees);'><br>
  9.                     </td>
  10.                     <td bgcolor=$color4 align=right>
  11.                     <select size=8 name=members[]  style='width: 250;' dir=rtl multiple='yes'>
  12.                     </select>



Heya, NourB. Welcome to TSDN!



Set the name of your select to "varname[]" (note the brackets):

Expand|Select|Wrap|Line Numbers
  1. <select name="mySet[]" multiple="multiple">
  2.     <option value="1">one</option>
  3.     etc.
  4. </select>
  5.  
For a working example, take a look at this page.
May 22 '07 #3

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

Similar topics

7
by: Felix Natter | last post by:
hi, I have a php-Script which gets passed a Boat-ID and this is used to mark an element in a <select> as the default: <select name="boote" multiple="multiple" size="5"> <option...
3
by: Disco-181 | last post by:
Hi, I have a script which isn't working in Mozilla based browser for some reason. I'm trying to run two functions from the body onload tag and it simply isn't happening. I have a cascading...
2
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
2
by: ggk517 | last post by:
I have a script like below: ------------------------------------------------------------------------------------------------------------------------ <html> <head> <title>TEST</title> <script...
1
by: shidram | last post by:
Hello sir, I have problem while using javascript with HTML multiple selection tag, I want to write javascript in such a way that if a I change the option by clicking on the radio button on html...
92
by: bonneylake | last post by:
Hey Everyone, Well i was hoping someone could explain the best way i could go about this. i have a few ideas on how i could go about this but i am just not sure if it would work. Right now i...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
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: 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...
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
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.