SHARE
TWEET

PHP help

a guest Dec 3rd, 2019 207 in 23 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php    
  2. require('config.php');    
  3. require('header.php');    
  4. if(isset($_POST['update']))    
  5. {    
  6. $iduser = $_POST['userid'];    
  7. $name=$_POST['name'];    
  8. $pass=$_POST['pass'];    
  9. $tier=$_POST['level'];  
  10.    
  11. //UPDATE NEW RECORD    
  12. $result = mysqli_query($samb, "UPDATE pengguna SET name='$name', password='$pass',status='$tier' WHERE iduser='$iduser'");    
  13.  
  14. //SHOW MESSAGE WHEN UPDATE SUCCESS    
  15. echo "<script>alert('Update Record Success');    
  16. window.location='worker.php'</script>";    
  17. }    
  18. <?php    
  19. //GET ID FROM URL    
  20. $id = $_GET['update_id'];    
  21. //CHOOSE DATA FROM RECORD ID    
  22. $result = mysqli_query($samb, "SELECT * FROM user    
  23. WHERE iduser='$id'");    
  24. while($res = mysqli_fetch_array($result))    
  25. {    
  26. //show real value    
  27. $user = $res['iduser'];    
  28. $worker= $res['name'];    
  29. $pass = $res['password'];    
  30. $level = $res['status'];    
  31. }    
  32. <html>    
  33. <center>    
  34. <body>    
  35. <?php echo $user;?>    
  36. <h3>UPDATE WORKER RECORD</h3>    
  37. <form name="form1" action="update\_worker.php" method="POST">    
  38. <table width="700" border="1" align="center">    
  39. <tr>    
  40. <td width="200">WORKER NAME:</td>    
  41. <td width="400"><input type="text" name="userid" size=30    
  42. id="name" value="<?php echo $user;?>" /></td>
  43. </tr>    
  44. <tr>    
  45. <td width="200">PASSWORD:</td>    
  46. <td width="400"><input type="text" name="pass" id="pass" value="<?php echo $pass;?>" /></td>    
  47. </tr>    
  48. </table>    
  49. <input type="hidden" name="level" value=<?php echo $level;?>>
  50. <br><br>
  51. <input type="submit" name="update" id="submit" value="UPDATE" /></br>
  52. <font size="1" color="#ff0000">    
  53. </font>    
  54. <br>    
  55. </form>    
  56. <a href="worker.php">To worker list</a><br>
  57. </center>    
  58. </body>    
  59. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top