Portal Home > Knowledgebase > Articles Database > [PHP] Passing array as string from one file to the next - please help.


[PHP] Passing array as string from one file to the next - please help.




Posted by dpny, 03-02-2008, 01:51 PM
Ok, I am really stuck on this and been searching on here as well as google for the last 2 hours without any luck. Here is the situation: I want to pass a multi selectable checkbox as an array to one file called index.php, so on my form page.. I have a for loop that repeats this process 16 times. The form is processed using GET method. Now, the index.php holds the variable so I retrieve it using: Cool, this will print out each value... now I want to pass this entire array into a second page in this manner, on the same page: I want the $song to carry out the entire array which was passed into index.php to 2nd_page.php.... how can I do that? I dont really want to print out the $value really, that was to see if it works. I've tried doing this on index.php $song = $_GET['song']; and then I did echo to see what shows, it simply displays "Array" nothing else. How can I do this? Thanks in advanced. -DPNY

Posted by Harzem, 03-02-2008, 01:57 PM
It is NOT secure, but anyway I'll say how: serialize

Posted by Sillysoft, 03-02-2008, 02:51 PM
You can store it in a session:

Posted by dpny, 03-02-2008, 04:21 PM
store into session seem's like a great idea. I am also passing down other information such as id and some other field. I can store them on session. What if the user came back and submited the form again? Is there a way to destroy the session once I do the loop and get what I wanted?

Posted by dpny, 03-02-2008, 05:32 PM
Thank you guys.. I got it working through session then I am simply destroying the session. Really appriciate all the help.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
what is Cloud reseller (Views: 666)
Alabanza Host Listing (Views: 699)