$_POST[] question
Moderator: General Moderators
$_POST[] question
say i use a loop to create 20 input in a form. Each input's name is item1, item2, item3.... etc. Now i send it to a php script, how would i use a loop to read the inputs value?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Re: $_post
Check out variable variables:valen53 wrote:" how would i use a loop to read the inputs value? "
http://www.php.net/manual/en/language.v ... riable.php
Mac
i dont know if this is the "real" way to do it but say the the inputs name were item1, item2, item3.. etc. I use this loop to do it
Code: Select all
//$item_num is a variable i set in the loop to create the inputs so i have a count of inputs the loop does.
//I use the substr_replace to add $count to the end of $name getting item1 than item2 etc.
for($count=1;$count<=$item_num;$count++)
{
$name="item";
$name=substr_replace($count,$name , 0, 0);
$store_itemї$count]=$_POSTї$name];
}