I'm always open to a more elegant solution (or a learning opportunity),
but this probably doesn't warrant any more of the list's time. I was
just looking for a simpler way to create a slew of hidden variables that
lurk while the user previews their submission (as it would appear on the
live page) before clicking the final submit.
Ross's solutions did indeed work for me--and at his insistence I will
change my argument from a string to an array. I do love exploding
things, though . . . .
Thanks, as always, for the help--and the offer of a more elegant solution!
Andrew
Andrew Nagy wrote:
> 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
|