What's new

Closed Update field using html form input and php

Status
Not open for further replies.

abujuguluy

Addict
Joined
Aug 4, 2014
Posts
22
Reaction
1
Points
73
Age
27
Hello po mga sir magandang umaga, patulong naman po sa code ko di ko kasi mapagana.
Code:
<tr>
                                         
                                           <td><?php echo $product_row['name']; ?></td>
                                           <td><?php echo $member_row['Firstname']." ".$member_row['Lastname']; ?></td>
                                           <td><?php echo $cart_row['price']; ?></td>
                                           <td><?php echo $cart_row['qty']; ?></td>
                                           <td><?php echo $cart_row['total']; ?></td>
                                           <td><?php echo $cart_row['status']; ?></td>
                                           <td><?php echo $cart_row['modeofpayment']; ?></td>
                                       
                                           <form action="update_sir.php" method="get">
                                           <td ><input type="text" name="sales_invoice_number">   <input type="submit" value="Confirm"></td>
                                       </form>
                                              <td><?php echo $cart_row['date'];?></td>
                                           <td width="140"><a href="update_status.php<?php echo '?id='.$order_id; ?>" class="btn btn-success"><i class="fa fa-check"></i>&nbsp;Confirm Order</a></td>
                                   

                                       </tr>

Ang dapat kasi na mangyari e bago maging clickable ung Confirm Order e dapat ma update muna nung admin ung sales invoice number na nasa table, ang problema ko di nag uupdate ung sales_invoice_number.
Eto naman ung get_sir.php code ko
Code:
<?php
include('connect.php');
$sir = $_GET["sales_invoice_number"];
mysql_query("update order_details set sales_invoice_number ='$sir' where orderid='$get_id'")or die(mysql_error());


            header('location:orders.php');

?>
 
Wala bang error na lumalabas? San galing yung $get_id, wala akong nakitang nakadeclare. Tsaka use POST instead of GET, atleast additional security. I think yung kulang lang dyan ay yung $get_id, walang mauupdate kasi di naman nakadeclare yung $get_id.
 
Wala bang error na lumalabas? San galing yung $get_id, wala akong nakitang nakadeclare. Tsaka use POST instead of GET, atleast additional security. I think yung kulang lang dyan ay yung $get_id, walang mauupdate kasi di naman nakadeclare yung $get_id.
edi sir dapat
Code:
<?php
include('connect.php');
$get_id = $_GET["id"];
$sir = $_GET["sales_invoice_number"];
mysql_query("update order_details set sales_invoice_number ='$sir' where orderid='$get_id'")or die(mysql_error());


           header('location:orders.php');

?>
ganyan ba sir? di rin gumagana e. walang error na lumalabas
 
Pwede patingin ng whole codes? Pati database structure? Sama mo na din yung mismong page. Screenshots will do.
 
Pwede patingin ng whole codes? Pati database structure? Sama mo na din yung mismong page. Screenshots will do.
sige sir maraming maraming salamat po sa tulong nyo, defense na namin sa monday ayusin ko lang po ung mga hinihingi nyo wait
 
6EnbkFg
<< eto ung db structure sir, You do not have permission to view the full content of this post. Log in or register now. << eto ung code nung sa may table You do not have permission to view the full content of this post. Log in or register now.<<< eto ung update_sir.php tapos eto ung page You do not have permission to view the full content of this post. Log in or register now.<< eto ung page sir
 
Pwede patingin ng whole codes? Pati database structure? Sama mo na din yung mismong page. Screenshots will do.

You do not have permission to view the full content of this post. Log in or register now. << eto ung db structure sir, You do not have permission to view the full content of this post. Log in or register now. << eto ung code nung sa may table You do not have permission to view the full content of this post. Log in or register now.<<< eto ung update_sir.php tapos eto ung page You do not have permission to view the full content of this post. Log in or register now.<< eto ung page sir
 
Add ka ng <input type="hidden" name="id" value="<?php echo $order_id; ?>" /> before <input type="text" ... or basta nasa loob ng form tag. Then use method="post" instead of method="get" pero pwede din naman yung get but not that secured. Tapos sa update_sir.php change $_GET to $_POST. Remove mo na din yung single quote mo sa '$sir' tsaka '$get_id' sa sql query mo since integer naman datatype nyan.
 
Add ka ng <input type="hidden" name="id" value="<?php echo $order_id; ?>" /> before <input type="text" ... or basta nasa loob ng form tag. Then use method="post" instead of method="get" pero pwede din naman yung get but not that secured. Tapos sa update_sir.php change $_GET to $_POST. Remove mo na din yung single quote mo sa '$sir' tsaka '$get_id' sa sql query mo since integer naman datatype nyan.

Sir maraming maraming maraming maraming maraming maraming maraming maraming maraming maraming maraming salamat! Isa kang anghel kagabi ko pa iniisip to di ko magawa. Tapos sir ung
Code:
 <td width="140"><a href="update_status.php<?php echo '?id='.$order_id; ?>" class="btn btn-success"><i class="fa fa-check"></i>&nbsp;Confirm Order</a></td>

pano ko siya gagawing clickable lang kapag na pindot ko na ung confirm button sa sales_invoice_number?
 
Gawin mo nalang button yan, tapos lagay mo din sa form tag, same process ng ginawa mo sa sales invoice then gawin mong ganito:

Kung yung value ng sales_invoice_number sa ay null kapag di pa nappindot confirm sa sales invoice:

HTML:
<td width="140">
<form action="update_status.php" method="post">
<?php If ($ornumber != null) : ?>
<input type="submit" value="Confirm Order">
<?php else : ?>
<input type="submit" value="Confirm Order" disabled>
<?php endif; ?>
</form>
</td>

Kung 0 naman value ng sales invoice number pag di pa nacoconfirm, palitan mo lang yung condition
 
Status
Not open for further replies.
Back
Top