Re: multiple input boxes
- From: "BKDotCom" <bkfake-google@xxxxxxxxx>
- Date: 22 Nov 2006 08:39:19 -0800
don't name them the same! :)
if you're going through a loop
$name = $i.'_id';
$name = $i_'first_name';
etc
or, a bit more clever $name = 'user['.$i.'][id];
ie <INPUT name="user[1][id]">
<INPUT name="user[1][first_name]">
<INPUT name="user[1][last_name]">
<INPUT name="user[2][id]">
will create a $_POST var that looks like this when submitted
$_POST = array(
user = array(
1 => array(
'id' => 'whatever',
'first_name' => 'whatever',
'last_name' => 'whatever',
),
2 => array(
'id' => 'whatever',
),
),
);
Auddog wrote:
I have a form that I'm creating that queries my database for active users,
puts them in a list and then adds an input box for each line. I'm having
troubles trying to figure out how I would then input the information from
the input box into my table when submitted. Each line lists out the id,
first name, last name from the query, but each input box is named the same.
How would I change the name of each input box?
Hopefully this makes some sense. Thanks for any help that you can provide.
A
.
- Follow-Ups:
- Re: multiple input boxes
- From: BKDotCom
- Re: multiple input boxes
- References:
- multiple input boxes
- From: Auddog
- multiple input boxes
- Prev by Date: Re: php mysql form variable works one time
- Next by Date: Re: multiple input boxes
- Previous by thread: multiple input boxes
- Next by thread: Re: multiple input boxes
- Index(es):
Relevant Pages
|