Solved

php: html multiple select list, save all values

Posted on 2006-07-18
7
253 Views
Last Modified: 2012-08-13
Hello,

I have a standard HTML multiple select list.  I am using javascript to add/remove items from the list dynamically.  However I want to use a "Save" button to save the entire list to a database.  PHP only posts the selected items however.  Is there anyway to grab the entire list? Without making the user make sure all of them are selected?

Thanks
0
Comment
Question by:killer455
  • 2
7 Comments
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 17132374
Use javascript to select them all on submit, or to write all the values to hidden elements.
0
 

Author Comment

by:killer455
ID: 17133928
Ok please give an example.

0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 17134403
That's a javascript question.  The folks over there will no doubt have a more elegant solution.  You can post a pointer question there so they'll know to look here.
0
 
LVL 5

Accepted Solution

by:
techroot earned 50 total points
ID: 17136163
This site, http://www.mredkj.com/tutorials/tutorial007.html has examples on 2 ways you can do what you are looking for. The first uses javascript to get all of the values and tie them together in the query string while the second just selects all of the items on the list with js and then submits them like a normal form. Both ways would work but I would recommend the first way because the second way looks less professional when you submit the form when you see the entire list light up selected for a moment after cliking the submit button. After you intergrate the html and js for eaither of the methods, this page has the php code needed to break the items into an array/display them on the screen, http://innovationlost.org/mredkj/tutorial007.php
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

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 50
How to read data from SQL server  to sharepoint 2013 ? 3 26
html input 8 42
Search Item in Table 2 19
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 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