update multiple text field
Posted: Wed Jan 06, 2010 3:30 am
i have a form consists of multiple text fields. the purpose of the form is for admin to update the order of multiple products (pulling from database). Single submit button should submit the form and update the order of respective products.
The problem here is, i dont know the number of the text fields will be displayed so i used textfield[] for each text field and for loop to loop through everysingle text field
-> i dont even know which field belong to which product T.T
I'm thinking of using the same sql select statement to select all product and just update the product order like (not writing in php, just the logic)
$i=0;
while($row['order']=...)
{
update $row['order']=textfield[$i]
$i++;
}
is there any smarter way to go? If no, is there any problem using the above logic?
The problem here is, i dont know the number of the text fields will be displayed so i used textfield[] for each text field and for loop to loop through everysingle text field
-> i dont even know which field belong to which product T.T
I'm thinking of using the same sql select statement to select all product and just update the product order like (not writing in php, just the logic)
$i=0;
while($row['order']=...)
{
update $row['order']=textfield[$i]
$i++;
}
is there any smarter way to go? If no, is there any problem using the above logic?