Page 1 of 1

$_POST[] question

Posted: Thu Apr 17, 2003 11:47 pm
by nincha
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?

Posted: Fri Apr 18, 2003 12:22 am
by nincha
nevermind about the question, i just found out a way to do this, thnx anyways guys.

$_post

Posted: Fri Apr 18, 2003 1:59 am
by valen53
" how would i use a loop to read the inputs value? "

can u tell me how u to do that ? cause i also facing this problem now..
thank's reply

Posted: Fri Apr 18, 2003 4:53 am
by m3mn0n
I'd imagine just call for the results in a similar way you would loop the text input areas. :)

Re: $_post

Posted: Fri Apr 18, 2003 5:25 am
by twigletmac
valen53 wrote:" how would i use a loop to read the inputs value? "
Check out variable variables:
http://www.php.net/manual/en/language.v ... riable.php

Mac

Posted: Fri Apr 18, 2003 1:33 pm
by nincha
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++)
	&#123;
	$name="item";
	$name=substr_replace($count,$name , 0, 0);
	$store_item&#1111;$count]=$_POST&#1111;$name];
                &#125;