|
Posted by Ed on 08/26/05 07:09
adam wrote:
> not sure if this is possible, ie:
>
> <input type="text" id="table1[username]">
> <input type="text" id="table1[password]">
> <input type="text" id="table2[bioText]">
>
> i'm assuming i could then get the value of the username with
>
> $username = $_POST[table1][username];
> etc...
>
> ideally what i'd like to do is loop through this multidimensional array
> with a function, so that each [table] key allows for posting different
> arrays of data to a different table (ie: table1 might be the user info,
> table2 might be extended profile data if they're updating their profile
> as well.. you get the idea).
>
> foreach() doesn't seem like it would work, unless something like
> $key[$key] is possible, but i doubt it :P
Hi there,
Perhaps someone else has a better solution, but have you tried a
foreach() loop inside a foreach() loop? For instance:
foreach ($_POST as $key => $value) {
if (is_array($value)) {
foreach ($value as $whatever) {
// do something
}
}
else {
// do something with $key and $value
}
}
Good luck,
Ed
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
[Back to original message]
|