php self processing forms and passing arrays
Posted: Tue Sep 28, 2004 7:52 am
Hi,
I am hoping that someone can come up with a solution to a problem I am having.
I have a self processing form with two select lists. basically I want the left list populated with some default values and when an item is selected and the submit button pressed the value is copied over to the select box on the right. Values can be added and removed at will.
I have attempted to do this by creating a hidden field with the right hand select box's contents in:
<input type="hidden" name="current_cont[]" value="<?=$cont?>">
when I load the page I check for current_cont. If it is populated I create the new right hand list by merging current_cont and the results from any select operation on the left hand list.
When I try to use this I am getting valid values on the first select, but subsequently all that is displayed is a list containing array and the last value I selected.
I hope that this makes sense and can be followed.
Many thanks
I am hoping that someone can come up with a solution to a problem I am having.
I have a self processing form with two select lists. basically I want the left list populated with some default values and when an item is selected and the submit button pressed the value is copied over to the select box on the right. Values can be added and removed at will.
I have attempted to do this by creating a hidden field with the right hand select box's contents in:
<input type="hidden" name="current_cont[]" value="<?=$cont?>">
when I load the page I check for current_cont. If it is populated I create the new right hand list by merging current_cont and the results from any select operation on the left hand list.
When I try to use this I am getting valid values on the first select, but subsequently all that is displayed is a list containing array and the last value I selected.
I hope that this makes sense and can be followed.
Many thanks