[PHPLIB] oohforms: array of form elements From: Bob Strouper (bobw123 <email protected>)
Date: 10/25/99

Hello,

OK, page1(sending) and page2(recieving) :-)

On page one I usually group together the form elements
in an mock array "fields[form_element]" like so:

...
<textarea name=fields[some_name] ...
<input type=text name=fields[some_other_name]...
...

Now on page2 php will turn the forms' mock array
into real arrays.

I use this method so when building forms from
database tables I don't have to know what the db
field names are and also so I can separate the
'$fields[] form elements' from other form
elemets in the $HTTP_POST_VARS array that
I don't want included in the DB query I build.

..as in ( on page2):

while (list($key, $val) = each($fields)){
...
$fields_string .= "$key, ";
...
$value_string .= "$key = $val, ";
...
$query = "INSERT INTO $table ($fields_string) VALUES ($value_string)";
}

So finnally to my question :-)
Would doing the same ( making the name element
as part of an array ) in oohforms really screw oohforms up?:

$form->add_element(array("name"=>"fields[some_name]",...));
$form->add_element(array("name"=>"fields[some_other_name]",...));

I have to admit I have't tryed it yet :-)

Looking forward to your comments.

Bob

__________________________________________________
FREE Email for ALL! Sign up at http://www.mail.com

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.