Hi,
I am trying to access the variables through POST from an html post by using
$a=$_POST['a1'];
works fine.
Actually i have the vaiables from a1 to a28 getting posted from the html page. Is there any way I can use something like """ $a=$_POST['a'$i];""" ?? I want to read the $_POST array using a loop.
Eg.,
for ($i = 28; $I >=0; $i--)
{
$a=$_POST['here I want to substitute $i for a1, a2, a3...'];
}
Any help will be highly apreciated;
Many thanks in advance
Ushas Symon
retrieving values form $_POST using loop
Moderator: General Moderators
-
ushassymon
- Forum Newbie
- Posts: 1
- Joined: Sun Feb 15, 2009 7:10 am
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Re: retrieving values form $_POST using loop
Code: Select all
for ($i = 28; $i >=0; $i--)
{
$X = sprintf("a%d",$i);
$a=$_POST[$X];
}
"This forum is not for asking programming related questions."
(And don't mix caps and small i's in your loops.)