Yohanne Posted September 5, 2013 Share Posted September 5, 2013 Hi coders, any body help, if possible image below, i use only one submit button? note: page2 is not totally viewing data. Ex. page1 <form name = "form" action = "page2" method = "post"> <input type = "text" name = "search_code" value = ""> <input type = "text" name = "quantity" value = ""> <input type = "submit" name = "submit" value = "submit"> </form> page2 | now here is i need to update first the value of quantity to get the latest value of it. before i add into sold item. $x = mysql_query("UPDATE itemT SET quantity = '$_POST[quantity]' WHERE item_code = '$_POST[search_code]'"); $data_query = mysql_query("SELECT ..... "); if($result) { while($row = mysql_fetch_array($result)) { ?> <input type = "text" name = "item_id" value = "<?php echo $row['item_id']; ?>"> <input type = "text" name = "item_code" value = "<?php echo $row['item_code']; ?>"> <input type = "text" name = "item_name" value = "<?php echo $row['item_name']; ?>"> <input type = "text" name = "sold" value = "<?php echo $row['sold']; ?>"> <input type = "text" name = "quantity" value = "<?php echo $row['quantity']; ?>"> <?php } ## in this part, i am trying to find good solution but not luck and i dont know the right way to out of scenario.## $_POST['sold'] = $_POST['sold'] + $_POST['quantity']; $query_update = mysql_query("UPDATE itemT SET sold = '$_POST[sold]'"); header('Location:page3 or page1'); } Link to comment https://forums.phpfreaks.com/topic/281871-seacrch-and-update/ Share on other sites More sharing options...
Yohanne Posted September 5, 2013 Author Share Posted September 5, 2013 solve here Link to comment https://forums.phpfreaks.com/topic/281871-seacrch-and-update/#findComment-1448232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.