KHIT

ds_update

Jun 5th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2. include '../inc/connect.php';
  3. $data = mysql_query("SELECT * FROM content" ) or die(mysql_error());
  4.  
  5. //Henter indhold fra formular
  6.  $titel = mysql_real_escape_string($_POST['titel']);
  7.  $overskrift = mysql_real_escape_string($_POST['heading']);
  8.  $tekst = mysql_real_escape_string($_POST['tekst']);
  9.  $id = mysql_real_escape_string($_POST['id']);
  10.  
  11. // Indsæt i tabel
  12.  
  13.    if (isset($_POST['submit'])) {
  14.        $tabeldata = "UPDATE content SET titel = '$titel',heading = '$overskrift',tekst = '$tekst' WHERE id = '$id'";
  15.        $resultat = mysql_query($tabeldata);
  16. if($resultat) {
  17.     header ('Location: ../index.php?msg=SUCCES');
  18.    }
  19.  else {
  20.      header ('Location: ../index.php?msg=FAILED');
  21.  }
  22.  }
  23. else {
  24.     header('Location: ../index.php?msg=ACCESS_DENIED');
  25.  
  26. }
  27. mysql_close();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment