steve m Posted November 7, 2006 Share Posted November 7, 2006 Hi All,I'm trying to write a script where I can change for example, multiple prices from a dynamically created form. I first have a form where it get info from the database and displays it in a list. What I did was where the field that I want to be able to change I made it a text box. This works fine. The problem that I'm having is the POST. In the text box value I made it an array, so when I submit the form it shows me all of the values for that text box if I use a foreach loop.[code]<? php echo "<input type=\"text\" value=\"$cst\" name=\"cst[]\" size=\"5\">"; ?>[/code]$cst is the cost field.What I want to do is to go thru that array and update the records, but I can't seem to figure out on how to associate the record Id(inv_id) to the $cst when submitting the form. I need to query the database to look up the inv_id to update the cost column. Does anyone have any ideas on how to solve this dilemma? Link to comment https://forums.phpfreaks.com/topic/26453-trying-to-update-multiple-records/ Share on other sites More sharing options...
xtentic Posted November 7, 2006 Share Posted November 7, 2006 name="cst[' . $cst_id . ']" value="' . $cst . '">and then you read all cst arrays[code]<?phpif ($_SERVER['REQUEST_METHOD'] == "POST" && isSet($POST['cst'])){ foreach ($_POST['cst'] as $id as $value) { // etc }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/26453-trying-to-update-multiple-records/#findComment-120965 Share on other sites More sharing options...
steve m Posted November 7, 2006 Author Share Posted November 7, 2006 It doesn't seem to work. I get a parse error from the foreach loop. Link to comment https://forums.phpfreaks.com/topic/26453-trying-to-update-multiple-records/#findComment-120971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.