Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing an Array from one page to another

Status
Not open for further replies.

roccothegreat

Programmer
Aug 5, 2002
6
US
I have been trying to pass an array from one page to another. However, I only recieve the value of the last item. I cannot access the rest of the values. I perform this by passing an HTML input=&quot;hidden&quot; object and have the value = <? echo &quot;$myarray&quot; ?>. Do I need to have the brackets when passing the array (i.e. $myarray[])?

I appreciate all who can help!

 
This piece of code should work:
while (list($key, $val) = each($array))
echo &quot;<input type=\&quot;hidden\&quot; name=\&quot;array[$key]\&quot; value=\&quot;$val\&quot; />&quot;;
That should make the exact same array available to the receiving script through $_POST['array']. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top