Advertisement
Guest User

modify.php

a guest
Jan 28th, 2014
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1.  
  2. <?php
  3. include 'connection.php';
  4.  
  5. if(!isset($_POST['submit'])){
  6.  
  7. $q = "SELECT * FROM kunder WHERE ID = $_GET[id]";
  8. $result = mysql_query($q);
  9. $person = mysql_fetch_array($result);
  10.  
  11. }
  12.  
  13. ?>
  14. <h1>Du ändrar en användares information</h1>
  15. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  16. Namn: <input type="text" name="inputName" value="<?php echo $kunder['Name']; ?>"/> <br />
  17.  
  18. Problem: <input type="text" name="inputDesc" value="<?php echo $kunder['Description']; ?>"/><br />
  19. <br />
  20. <input type="hidden" name="id" value="<?php echo $_GET['id']; ?>" />
  21. <input type="submit" name="submit" value="Ändra" />
  22.  
  23.  
  24.  
  25. </form>
  26. <?php
  27.  
  28. if(isset($_POST['submit'])){
  29.  
  30. $u ="UPDATE kunder SET `Name`='$_POST[inputName]', `Description`='$_POST[inputDesc]' WHERE ID = $_POST[id]";
  31. mysql_query($u) or die (mysql_error());
  32.  
  33. echo "Användaren har ändrats";
  34. header("Location: edit.php");
  35.  
  36. }
  37. else{
  38.  
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement