Hi Everyone,
Here's something im' trying to do. I have a 2 dimensional array via some post values. Here's what it looks like. i've abbreviated here for readability.
[url] => Array ( [0] => www.urlgoeshere.com [1] => www.urlgoesheretoo.com [2] => www.urlgoesherethree.com [3] => www.urlgoesherefour.com [4] => www.urlgoeshere.com ) ) [info] => Array ( [0] => Website info goes here for website 3. Lorem ipsum etc. [1] => Website info goes here for website 3. Lorem ipsum etc. [2] => Website info goes here for website 3. Lorem ipsum etc. [3] => Website info goes here for website 4. Lorem ipsum etc. [4] => Website info goes here for website 5. Lorem ipsum etc. ) [add_id] => [add_manualid] => [add_url] => [add_info] => [submit] => submit )
I'm trying to break into 2 separate arrays so i can process and treat differently. I got the first half of this problem solved but not the second half. For the first half i did this....
this works, but i'm trying to figure out how to start and continue the foreach loop at the 4th element ('add_id').
what should i do.
and i'd like to add...
i really thought that if i echoed this. $_POST[0][0] i would get 78 but apparently not. what that echoes is NULL,
just for the sake of understanding. how would i echo a single value within the second loop. like say...
[id][1][79]
(which i thought would be $_POST[0][1] ..?)
..?
huge thanks for any help on this!
It's not clear to me what you actually want to do, but I can answer the second question: you would get the "78" value from $_POST['id'][0], since your first dimension's key is associative (string), not enumerated (integer) like the 2nd dimension is in that sub-array.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
This is a form that is part of a CMS. The first elements pull content from a table and are therefore used to either edit or delete. the last 4 (excluding the submit btn) are for adding new content (row count will be fixed) and may therefore may all be left empty upon form submission. They need to be put into 2 separate groups and the validated or handled differently. (ex. the last group may be left empty but the first may not.)
I could put into 2 separate forms but i'd thought it'd be good programming from the user's end to leave all on one form.
Bookmarks