Getting at $_POST values using a loop
| From: | Dave Alger | Date: | Mon, 23 Jun 2003 04:12:17 +0000 |
| Subject: | Getting at $_POST values using a loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-152473@lists.php.net to get a copy of this message | ||
Hi all,
This one is causing me a few headaches. How should I be doing this?
On my previous page I've created a series of fields using a loop so that a
field is created like this:
echo "<hr>$fieldname:<input name='Field$n'
maxlength='25'>";
On my next page then I've got to try to read these values. I could do this
as $_POST['Field0'], $_POST['Field1'] etc but a loop is what is required.
I've tried getting at the value by:
$a=$_POST['Field$n'];
and
$nb='$'."_POST['Field".$n."']";
$a=$$nb;
And neither works. How should I be doing it?
Thanks in advance for all help.
regards,
Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003