|
Posted by Martin on 08/10/05 03:22
On 9 Aug 2005 16:30:25 -0700, "Ken Robinson" <kenrbnsn@rbnsn.com>
wrote:
>
>Martin wrote:
>> I have a page with a form on it in which I have a series
>> of input fields like so (note the sub-scripted name):
>>
>> <input type='text' name='rating[1]' value='1'>
>> <input type='text' name='rating[2]' value='2'>
>> <input type='text' name='rating[3]' value='3'>
>>
>> How do I retrieve the submitted values in a PHP script?
>>
>> For example, just trying to echo the current value
>> displays nothing (and there IS a value being submitted)
>>
>> echo("rating[$i]=".$_POST['rating[$i]']."<br>");
>
>Think about how you would get the value from a multi-level array:
>$x = array('level1'=>array('1','2'),'level2'=>array('2','4'));
>echo $x['level1'][0];
>
>So, in your case, use:
>
>echo 'rating['.$i.']='.$_POST['rating'][$i].'<br>';
>
>Read up on arrays at www.php.net/array
>
>Ken
Thank you.
[Back to original message]
|