Guest User

Untitled

a guest
Jan 22nd, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html>
  4. <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <link rel="shortcut icon" href="favicon.png" type="image/x-icon"/>
  6. <link rel="icon" type="image/png" href="favicon.png" />
  7. <title>Registro</title>
  8. </head>
  9.  
  10. <body>
  11. <div>
  12.  
  13. <?php
  14. $id=$_GET['id'];
  15.  
  16. $mysqli = NEW MySQLi('localhost','usuario','password','basedatos');
  17.  
  18. $queryb=mysqli_query($mysqli,"select * from users where id='$id'");
  19.  
  20. $result=mysqli_fetch_array($queryb);
  21.  
  22. if(isset($_POST['submit'])){
  23. $username= $_POST['username'];
  24. $name= $_POST['name'];
  25. $pass= $_POST['pass'];
  26.  
  27.  
  28.  
  29. $queryc= "update users set username='$username', name='$name', pass='$pass' WHERE id='$id'";
  30.  
  31. $insert = $mysqli->query($queryc);
  32.  
  33. if($insert){
  34. header('Location: regexitoso.php');
  35.  
  36. }else{
  37. echo "La consulta no se realizó";
  38. }
  39.  
  40. $mysqli->close();
  41.  
  42. }
  43. ?>
  44. </div>
  45. <div>
  46. <h1>Modificar información de <?php echo $result['name']; ?></h1>
  47.  
  48. <form action="" method="post" name="registro" id="formulario"><br><br>
  49. <table>
  50. <tr><td>Usuario: <input type="text" name="username" id="username" value="<?php echo "$result[username]"?>"></td>
  51. </tr>
  52. <tr><td>Nombre:<input type="text" name="name" id="name" value="<?php echo "$result[name]"?>" ></td>
  53. </tr>
  54. <tr><td>Contraseña: <input type="password" name="pass" value="<?php echo "$result[pass]"?>"></td>
  55. </tr>
  56. <tr><td> <input name="submit" id="submit" type="submit" value="Actualizar" /></td></tr>
  57. </table><br><br>
  58. </form>
  59. </div>
  60.  
  61. </body>
  62. </html>
Add Comment
Please, Sign In to add comment