PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a page which allows a user to add items to a listbox. When the form submits I want to capture all values from the listbox on a second page as an array so that I can save them to a table. I am currently using the request method however I am only capturing one of the values from the list box and cant' seem to find any examples on how to proceed. Any help will be appreciated.
Thank you,
Josh
The code for the two files is as follows:
file: test1.php
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Thank you for the response. I inserted the requested and and was able to return the last item from the list box.
For instance if I entered values (111, 112) into the listbox on page test1.php and highlighted both values before submitting, the echo on page2.php returns:
<select name="multi_box[]" size="10">
<!-- Options here -->
</select>
I am guessing that you are building the listbox as a single list box. Since the data is sent as an array, but it is being dimensioned as a 1D array, you are only getting the last value as all the earlier values are overwritten for each value passed.