Robert1000
Programmer
Two questions:
1) Is there a way to get the name of the form field when looping via foreach through the $_POST/$_REQUEST arrays?
ie if i have a field called txtUsername can i get this from $_POST? Simply to automatically create a variable for each form item.
something like:
foreach($_REQUEST as $blah)
{
print $blah->Name;
}
2) Also, why cant i use $_REQUEST[0], $_REQUEST[2] etc. If its a standard array this should work right? all that seems to work is something like
foreach($_REQUEST as $blah)
{
print $blah;
}
id have thought this would work
for ($i=0;$i<count($_REQUEST);$i++)
{
print $_REQUEST[$i];
}
of course it doesn't which is really strange. as count($_REQUEST) works fine
Cheers for any help
Rob
1) Is there a way to get the name of the form field when looping via foreach through the $_POST/$_REQUEST arrays?
ie if i have a field called txtUsername can i get this from $_POST? Simply to automatically create a variable for each form item.
something like:
foreach($_REQUEST as $blah)
{
print $blah->Name;
}
2) Also, why cant i use $_REQUEST[0], $_REQUEST[2] etc. If its a standard array this should work right? all that seems to work is something like
foreach($_REQUEST as $blah)
{
print $blah;
}
id have thought this would work
for ($i=0;$i<count($_REQUEST);$i++)
{
print $_REQUEST[$i];
}
of course it doesn't which is really strange. as count($_REQUEST) works fine
Cheers for any help
Rob