You are here: Re: multiple input boxes « PHP Programming Language « IT news, forums, messages
Re: multiple input boxes

Posted by BKDotCom on 11/22/06 16:39

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация