multiple textboxes

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,

I do build an item list using a SQL query. I'd like the person being able to
define a quantity for each item using an input type="text" in the list the
reuse it when the datas are passed to an other script. The problem is how to
name the text as they can be passed to an other script ?

Thanks for helping.


Re: multiple textboxes

Bob Bedford wrote:
Quoted text here. Click to load it

Not knowing the results of your query, it's impossible to say.  But I
would suggest a unique name for each textbox based on the unique id
returned in your query.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: multiple textboxes


You can use the array style:

  <? foreach ($items as $it) { ?>

  <input name=qty[<?= $it['id'] ?>] type=text>

  <? } ?>

You can read the submitted values back like so:

  foreach ($_REQUEST['qty'] as $id => $val) {
    echo "Item $id has quantity $val.<br>"


John Peters

Quoted text here. Click to load it

Site Timeline