Jump to content

Seacrch and Update


Yohanne

Recommended Posts

Hi coders,

 

any body help, if possible image below, i use only one submit button? note: page2 is not totally viewing data. 

 

8521030449.png

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.