Re: $_POST[$variable]
| From: | CPT John W. Holmes | Date: | Thu, 11 Dec 2003 13:12:46 +0000 |
| Subject: | Re: $_POST[$variable] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172464@lists.php.net to get a copy of this message | ||
From: "Christian Jancso" <christian@cafe.ch>
> I have the following problem:
> How can I use variables in the $_POST statement?
> Here is my code:
>
> $old_station[$o] = $_POST['$i'];
> $new_station[$o] = $_POST['$i'];
$old_station[$o] = $_POST[$i];
$new_station[$o] = $_POST[$i];
Variables are not evaluated within single quotes, so you were making a
literal key of "$i".
$old_station[$o] = $_POST["$i"];
$new_station[$o] = $_POST["$i"];
Will work, also, as the variable $i will be evaulated within the double
quote string.
---John Holmes...