[FX.php List] Re-populating $_POST form data
Gareth Evans
gareth.evans at schawk.com
Fri Oct 24 15:42:05 MDT 2008
Here is an example of the way I do forms (although somewhat simplified) but
it may give you a nudge in the right direction. It's also a little more
secure (IMO) than just using $_POST. Don't know if it applies to your
situation though.
http://pastebin.ca/1235983
HTH
--
GARETH EVANS
> From: Jonathan Schwartz <jschwartz at exit445.com>
> Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Date: Fri, 24 Oct 2008 10:02:49 -0700
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Subject: RE: [FX.php List] Re-populating $_POST form data
>
> Errr...that's what I was attempting to do. Up until now, I used
> $_SESSION variables, and I can't do that in this project. I assumed
> that you could just set the $_POST variables from FMP query, and once
> set they would display and then POST when the form was submitted
> again.
>
> No?
>
> Well...No reason why I can't switch to PLAN C...using regular
> variables. Is that the common wisdom?
>
> If this were to be done, then, what would the syntax be for setting
> those variables in a loop? It's the lopping thing that is hanging me
> up. This is the first time that I'm refusing to write 80 discrete
> statements to set the form variables....in favor of a more elegant
> loop.
>
> foreach($findResult['data'] as $key => $value)
>
> {
>
> ?????????
>
> }
>
> Jonathan
>
> At 9:27 AM -0700 10/24/08, Troy Meyers wrote:
>> Jonathan,
>>
>> Are you really wanting to SET the $_POST variables? Don't you want
>> to be reading them out of the incoming POST (or perhaps a find
>> result) into a variable array and input fields for display and
>> re-posting when the form is submitted?
>>
>> Putting them into $_POST isn't going to propagate them to the next page.
>>
>> Maybe I'm misunderstanding your goal here.
>>
>> -Troy
>>
>>
>>> 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
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> --
> 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
More information about the FX.php_List
mailing list