Reply to Re: incrementing a register global

Your name:

Reply:


Posted by Sebastian Mendel on 06/16/05 10:38

Aaron Todd wrote:

> I am posting data to a php script. I have several variables that are the
> same except the number at the end is different. So the url of the called
> script will be something like:
>
> http://www.something.com/test.php?name1=Sam&name2=Bill&name3=Joe
>
> On my script I am using substr() and strrchr() to get the number of last
> variable:
>
> $names = substr(strrchr($_SERVER['QUERY_STRING'],"&"),7,1);
>
> I am then trying to run a loop to call each variable and just print it on
> the screen:
>
> for($i=1;$i<=$boxes;$i++){
> echo $_GET['name'].$i;
> }

did you tried foreach() with $_GET ( or $_REQUEST ) ?


foreach ( $_GET as $key => $var )
{
echo $key . ' => ' . $var;
}


but this is not "incrementing a register global" but 'accessing a
superglobale array'


--
Sebastian Mendel

www.sebastianmendel.de
www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet

[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

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