hawzze

Untitled

May 20th, 2021
717
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html> <head>
  2. <meta http-equiv="content-type" content="text/html; charset=windows-1251">
  3. <title> EDIT </title> </head>
  4. <body bgcolor=#e6f2ff>
  5. <h3>EDIT </h3>
  6.  
  7. <?php
  8. include "config.php";
  9. if(isset($_GET['edit']) && $_GET['edit'])
  10. {
  11.   $sql="SELECT * FROM User WHERE Code=" . (int)$_GET['edit'];
  12.   $result=$conn->query($sql);
  13.   $row=$result->fetch_assoc();
  14. ?>
  15. <form method="post" action="edit.php">
  16.   <table cellpadding="8">
  17.     <tr>
  18.       <td> Code: </td>
  19.       <td> <input type="hidden" size="55" name="Code"
  20.       value="<?php echo $row['Code']; ?>" /></td>
  21.     </tr>
  22.  
  23. <tr>
  24.   <td>Name:</td>
  25.   <td><input type="text" size="55" name="Name"
  26.   value="<?php echo $row['Name']; ?>" /></td>
  27. </tr>
  28.  
  29. <tr>
  30.   <td>Product Name</td>
  31.   <td><input type="text" size="55" name="ProductName"
  32.   value="<?php echo $row['ProductName']; ?>" /></td>
  33. </tr>
  34.  
  35. <tr>
  36.   <td>Quantity</td>
  37.   <td><input type="text" size="55" name="Quantity"
  38.   value="<?php echo $row['Quantity']; ?>" /></td>
  39. </tr>
  40.  
  41. <tr>
  42.   <td>Price</td>
  43.   <td><input type="text" size="55" name="Price"
  44.   value="<?php echo $row['Price']; ?>" /></td>
  45. </tr>
  46.  
  47. <tr>
  48.   <td>Pay</td>
  49.   <td><input type="text" size="55" name="Pay"
  50.   value="<?php echo $row['Pay']; ?>" /></td>
  51. </tr>
  52.  
  53. <tr>
  54.   <td>Sum</td>
  55.   <td><input type="text" size="55" name="Sum"
  56. value="<?php echo $row['Sum']; ?>" /></td>
  57. </tr>
  58. </table><p>
  59. <input type="submit" name="submit" value="Promeni">
  60. </form>
  61. <?php
  62. } else {
  63. if(isset($_POST['submit']))
  64. {
  65.   $sql="UPDATE User SET Name=' " . $_POST['Name'] .
  66.                " ProductName=' " . $_POST['ProductName'] .
  67.                   " Quantity=' " . $_POST['Quantity'] .
  68.                      " Price=' " . $_POST['Price'] .
  69.                        " Pay=' " . $_POST['Pay'] .
  70.   ",Sum=" .(float) $_POST['Sum'] . " WHERE Code=" . (int) $_POST['Code'];
  71.   $result=$conn->query($sql);
  72. }
  73.   $result=$conn->query("SELECT * FROM User ORDER BY Name ASC");
  74.  
  75. if ($result->num_rows <= 0)
  76.     echo "0 results";
  77.   else
  78.   {
  79.     $zag=array();
  80.   ?>
  81.   <table border="4" bordercolor="black" cellpadding="15" cellspacing="0" bgcolor="#e6f2ffw">
  82.   <tr>
  83.   <?php
  84.     foreach($zag as $v) echo "<th>" .$v. "</th>";
  85.   ?>
  86.   </tr>
  87. <?php
  88.  while($row = $result->fetch_assoc())
  89.     {
  90.  ?>
  91.  <tr bgcolor=#e6f2ff>;
  92.  <td> <?php echo $row["Code"]; ?> </td>
  93.  <td> <?php echo $row["Name"]; ?> </td>
  94.  <td> <?php echo $row["ProductName"]; ?> </td>
  95.  <td> <?php echo $row["Quantity"]; ?> </td>
  96.  <td> <?php echo $row["Price"]; ?> </td>
  97.  <td> <?php echo $row["Pay"]; ?> </td>
  98.  <td> <?php echo $row["Sum"]; ?> </td>
  99.  <td align=center> <a href="edit.php?edit=<?php echo $row['Code']; ?>"> EDIT </a> </td>
  100.  </tr>
  101.  <?php
  102.  }
  103.  }
  104.  }
  105. ?>
  106. </table>
  107. <?php   $conn->close();  ?>
  108. <p> <a href="index.htm#Menu"> Menu =>> </a>
  109. </body> </html>
  110.  
  111.  
RAW Paste Data