Jump to content

Seacrch and Update


Yohanne
Go to solution Solved by 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');
}
 
Edited by jayson_ph
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.