Re: Passing variables
| From: | Dean Hall | Date: | Mon, 21 Aug 2000 22:19:06 +0000 |
| Subject: | Re: Passing variables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2246@lists.php.net to get a copy of this message | ||
On Mon, 21 Aug 2000, Stacy Hunter wrote:
> I am having a similar problem as another poster from today but didn't find
> the answer in the responses.
>
> If I pass the variable from the original form then try to retain the
> variable value within the php responding form how do I retain the value of
> the variable?
>
> I have
>
> <?php
> if(isset($HTTP_POST_VARS))
> {
> (list($var, $val) = each($HTTP_POST_VARS));
> echo "<INPUT TYPE=HIDDEN NAME=$var><br>";
> }
Try this:
<?
if(isset($HTTP_POST_VARS)) {
foreach($HTTP_POST_VARS as $name => $val) {
?><INPUT TYPE="HIDDEN" NAME="<?=$name?>"
VALUE="<?=$value?>"><BR><?
}
}
?>
You just forgot to put the "value" attribute in the tag, but I also
thought you should see the "foreach" keyword in action.
Dean.
>
> but the value is not retained after the first post.
>
> Any input would be appreciated.
>
> Thanks.
>
> - Stacy
>
>
>