multidim array passed from HTTP_POST_VARS
| From: | Luis Muench | Date: | Thu, 05 Oct 2000 19:50:31 +0000 |
| Subject: | multidim array passed from HTTP_POST_VARS | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3363@lists.php.net to get a copy of this message | ||
Hello phreaks
I have a form and I pass all the values that are submitted thru
HTTP_POST_VARS to a function "update_lesson($id, $frm)" (all
HTTP_POST_VARS go into $frm array).
My question is: what happens if you are already passing an array
(from the form "preq[]")...does $frm automatically handle the array? Does
it become $frm["preq"][x], where x is a numerical key?
My problem is that I need to update multivariate values and I don't know
how to address them to be able to send them to the db.
I dont know if this is clear enough but here is the code:
case "update" :
update_lesson($id, $HTTP_POST_VARS);
print_lesson_list();
break;
//this calls the function and passes it the values from the form
//here is the function that handles the update:
function update_lesson($id, $frm) {
//this is just the part that updates the multivariate array
while (list ($key, $val) = each ($frm["glenum"][])) {
$qid = db_query("
INSERT INTO lesson_gle (l_id, glenum)
VALUES ('$id', '$val')
");
}
I know the above wont work...but how do I traverse this array?
--------------------------------------------------
Luis Muench luis@mecha.barry.edu
Project MECHA Webmaster (305)899-3626