Print

Print


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