Re: Arrays
| From: | Ligaya Turmelle | Date: | Tue, 09 Nov 2004 05:03:27 +0000 |
| Subject: | Re: Arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201590@lists.php.net to get a copy of this message | ||
There are a couple of ways to pass arrays (and their values) between pages. I personally would put the array into a session variable ($_SESSION - see reference) and access the various parts as needed. Another option is sending the whole array or it's parts as hidden fields in a form (access with the $_GET and $_POST - again see reference), but that means the user has to click a submit button.
If you are trying to store the array in a Database I would suggest you make each element of the array into it's own column of the database. Databases generally should only have 1 piece of information being saved per cell (think excel). If you would like a link to database design, let me know and I will send it.
If all you really were asking was how to iterate through an array - then I would recommend looking at the manual's page on arrays ( http://www.php.net/manual/en/language.types.array.php ).
Respectfully,
Ligaya Turmelle
References:
http://www.php.net/language.variables.predefined
Ben wrote:
I hope this is not a stupid question, but I am learning how to work with Arrays, and am having trouble figuring out how to move array values from page to page and/or store in a db. Once again, I am new to arrays (and fairly new to PHP for that matter), so please don't get too technical in replies. Thanks so much for help. ben