Embedding variables in $_POST[''] commands
Posted: Tue Jul 26, 2005 11:00 am
I'm having a bit of a head scratcher here, and wanted to see if one of you experienced PHP guys can help a mere infant of a PHP guy such as myself.
My problem is that I want to have a loop that will assign $_SESSION values by pulling $_POST values. I'm trying to loop through each with a FOR lop, but it won't recognize my embedded variables. Below is my code, and I'm just getting 0 for my $_SESSION values. Is there something wrong with my syntax?
My problem is that I want to have a loop that will assign $_SESSION values by pulling $_POST values. I'm trying to loop through each with a FOR lop, but it won't recognize my embedded variables. Below is my code, and I'm just getting 0 for my $_SESSION values. Is there something wrong with my syntax?
Code: Select all
for($i=0; $i<=15; $i++){
$_SESSION['q.$i'] = $_POST['quant_.$i'];
$_SESSION['w.$i'] = $_POST['watts_.$i'];
$_SESSION['summ.$i'] = $_POST['summ_.$i'];
$_SESSION['wint.$i'] = $_POST['wint_.$i'];
}