Reply to Re: How to retrieve a sub-scripted input field?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на 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

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