[FX.php List] Re-populating $_POST form data
Anders Monsen
andersm at alamark.com
Fri Oct 24 15:42:16 MDT 2008
You also could run this loop to set the variables from what you send
over in the form:
$query_string = $_SERVER['QUERY_STRING'];
parse_str($query_string);
foreach($_POST as $this_key => $this_value) {
$this_var = $this_key;
$$this_var = $this_value;
}
In this case, if you use the syntax <input type="text"
name="nameFirst" value="<?php echo $nameFirst;?>"> then the above
foreach should let you load the page and display the variable that you
sent in the POST.
This way you don't need to declare each variable, ie. $nameFirst =
$_POST['nameFirst'];
Not sure if that's what you're looking for...
Anders
On Oct 24, 2008, at 1:01 PM, Troy Meyers wrote:
> Jonathan,
>
> $_POST is populated with the POSTed data from the prior page. Though
> you can change values and add elements, that's not normally done.
>
> To send data to the next page via the POST mechanism, you need to
> have <input> or similar elements inside of the <form> region on the
> source page. It is the <input> data that is POSTed to the next page.
> You certainly can pre-set the values of the <input> fields with data
> from a FIND. Looping should be possible, though you may have an
> issue with the order the loop lays down the visible fields.
>
> But first, are all the fields from the FileMaker find the same kind
> of data? What kind?
>
> -Troy
>
>
>> 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
>
> _______________________________________________
> 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