Andrew, I think Ross's reply covers what you are asking for. But it
seems that you may not be doing what you are trying to do the best
possible way. If you want to explain what you are trying to do in more
depth, we may be able to help you devise a more elegant solution.
Andrew Nagy
Andrew Darby wrote:
> Hello, all. I apologise for once again posting a mundane question
> (rather than an interesting new idea), but this has vexed me for months
> now (in different incarnations). The problem:
>
> I'm passing POST variables (using import_request_variables) with the
> prefix $postvar_ , i.e., $email from page 1 becomes $postvar_email in
> page 2.
>
> Now, I want to dynamically assemble this sort of variable in a function,
> like so:
>
> function makeHiddenInputs ($variable_list) {
> $hidden_vars = explode(" ", $variable_list);
>
> foreach ($hidden_vars as $value) {
> print "<input type=\"hidden\" value=\"$postvar_" . $value . "\" name=" .
> $value . "\" />\n";
>
> }
>
> }
>
> The call for the function would look like this:
>
> makeHiddenInputs("title authors periodical volume issue page year
> language keywords agency");
>
> I'm trying to fill the value of the hidden input with the contents of
> the POST variable, i.e., the one with the name $postvar_title (or
> whatever), but it doesn't work that way. It just passes the $title
> variable from within the function, not the contents of $postvar_title.
> How should I be doing this?
>
> Thanks in advance,
>
> Andrew
|