At the moment, I have a script that has several text boxes, echoed out in a loop. The text boxes have names such as option[$i]; $i being an incremented number each time through the loop.
However, once I try and do something with those number after the page is reloaded, I can only access the lastest number. To show you what I mean, I have a sample of the code below:
Code: Select all
while($noc > 0){
$order = $order[noc];
$option = $option[noc];
$item = $_SESSION[noc];
$sql = "UPDATE `database` SET `column`='$order', `column`='$option' WHERE `column`='$item'";
$rs = mysql_query($sql) or die(mysql_error());
$noc = $noc-1;
}
...
...
$i = 1;
while($row = mysql_fetch_assoc($rs)){
$id = $row['id'];
$order = $row['order'];
$name = $row['name'];
echo"<br /><input type="text" name="order[$i]" value="$order" size="1" maxlength='3' />
Option $i: <input type="text" name="option[$i]" value="$name" />";
$i++
}This code will output this (I modified the script to show this):
9 -- >6, test93,
8 -- >, ,
7 -- >, ,
6 -- >, ,
5 -- >, ,
4 -- >, ,
3 -- >, ,
2 -- >, ,
1 -- >, ,
The numbers on the left are the incrementeres ($i) numbers, then the order[$i], and then the order[$i]. Any help would be appreciated,
Thanks.