Hello-
My problem is as follows.
I have a form that looks up a users records, and diplays a list box for each record. The number of records is different for different users.
For an easy example, let's say the database keeps track of previously registered pets per user. The user gets a form that displays a list box for each pet they registered. In the listbox, they can update the status of the pet.
The list box's are generated by hitting the database, returning a recordset, counting the rows, then looping through each row, creating a list box for each row.
The name of the listbox is incremented in the loop. So, if 3 rows were returned, I would get PETSTATUS0, PETSTATUS1, and PETSTATUS3 for the list boxes. I also record the number of rows created in $ROWS, which I store in a hidden form field: rows.
What I'd like to do, is now loop through the number of rows, and store the value in the listbox in a session variable. I've tried this, but it does't work:
for ($i = 0; $i < $_POST['rows']; $i++)
{
session_register('PetStatus{$i}');
$_SESSION['PetStatus{$i}'] = $_POST['PetStatus{$i}'];
}
To no avail. I get session variables with the name "PetStatus{$i}" and no value.
Any ideas?
Thanks,
Sledge