|
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]
|