PHPLIB-oohforms - Trying unsuccessfully to use "multiple" with type="text"
| From: | Rob | Date: | Tue, 29 Apr 2003 13:50:03 +0000 |
| Subject: | PHPLIB-oohforms - Trying unsuccessfully to use "multiple" with type="text" | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145653@lists.php.net to get a copy of this message | ||
I am using oohforms from phplib 7.4-pre2. I have a text element set to "multiple", however when I render the element, I only get the last data added. My reading of the manual indicates this should work.
"For other elements that may be array valued (notably text elements)
multiple calls to show_element will show successive values."
I'm sure I'm doing something stupid...I just can't find an example that will show it to me! What am I missing? (apologies in advance for stupid question)
-Thanks, Rob
Test code:
<?php
error_reporting (E_ERROR | E_WARNING | E_PARSE); //partial reporting only
with oohforms
require("oohforms.inc");
$f = new form;
$f->add_element(array("type"=>"text",
"name"=>"textbox",
"value"=>"first 1111",
"multiple"=>1));
$f->add_element(array("type"=>"text",
"name"=>"textbox",
"value"=>"second 2222",
"multiple"=>1));
$f->start();
$f->show_element("textbox");
$f->show_element("textbox");
$f->finish();
?>
HTML output:
<form name='' method='POST' action='/p/testmulti.php' target='_self'>
<input name='textbox[]' value="second 2222" type='text'>
<input name='textbox[]' value="second 2222" type='text'>
</form>