[Discuss] php foreach variable variable post

Dan Kressin dkressin at yahoo.com
Sat Dec 31 09:36:01 EST 2011


> From: Eric Chadbourne <eric.chadbourne at gmail.com>

>I want to generate the list of columns again, put those column names
>into $_POST[] to get the values made by the user in the form.
>
>Something like:
>
><?php
>
>$my_array4 = select_groups("group");
>
>foreach ($my_array4 as $v_element) {
>$$_POST[$v_element['column_name']]=pg_escape_string(trim($_POST[$v_element['column_name']]));
>}
>
>?>
>
>I know I'm close.  Any tips?
>
>Thanks,
>Eric


I'm not entirely sure I understand what you're trying to accomplish.  I thought $_POST was sort of "incoming-only", so if you're trying to prepopulate it for the 2nd page, I think you need to possibly use hidden input fields instead to pass the values forward.  On the other hand, if you're trying to get variables named for each incoming value, have you looked at the import_request_variables function?

Perhaps a short concrete example of your end game would be helpful.

-Dan




More information about the Discuss mailing list