[FX.php List] Re-populating $_POST form data
Andrew Denman
adenman at tmea.org
Fri Oct 24 10:42:22 MDT 2008
OK, I didn't pay full attention before.
If you're trying to put all of the returned records into the $_POST, the
easiest way is:
$_POST = $findResult['data'];
(gives you $_POST['recid.modid']['fieldname'][0])
If you want the first record's data:
list($key,$values) = each($findResult['data']);
$_POST = $values;
$_POST['-recid'][0] = strtok($key, '.'); // optional
$_POST['-modid'][0] = strtok($key); // optional, requires previous line
(gives you $_POST['fieldname'][0] with first record's data)
And ditto Troy's comments...
Andrew Denman
-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Andrew Denman
Sent: Friday, October 24, 2008 11:14 AM
To: 'FX.php Discussion List'
Subject: RE: [FX.php List] Re-populating $_POST form data
I don't think you need the extra [$key], since the values have already been
pulled out of the array:
foreach($findResult['data'] as $key => $value)
{
$_POST[$key] = $value[0];
}
Andrew Denman
-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Jonathan Schwartz
Sent: Friday, October 24, 2008 9:54 AM
To: fx.php_list at mail.iviking.org
Subject: [FX.php List] Re-populating $_POST form data
Hi folks,
Am switching my way of working with form data. Where I have been
using $_SESSION to display form values, I am reverting back to using
$_POST.
<...value="<?php echo $_POST['fieldname'];?>" ...>
This a big form with a lot of fields. I am also attempting to NOT
have to discretely parse out every field individually. I'd rather use
a loop.
So, how do you parse the FMP foreach statement to re-populate $_POST
valuse, so they can be re-displayed in a form. This is my latest
attempt...but it doesn't work.
foreach($findResult['data'] as $key => $value)
{
$_POST[$key] = $value[$key][0];
}
Thanks
Jonathan
--
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-370-5011
_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list
_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list