SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // Forbind til vores database
  3. include('db.php');
  4.  
  5. // isset = it exists / at den findes
  6. if (isset($_POST['firmanavn']) ) {
  7.     // Opret ny kunde
  8.     $kundeid = $_POST['kundeid'];
  9.     $firmanavn = $_POST['firmanavn'];
  10.     $adresse = $_POST['adresse'];
  11.     $postnr = $_POST['postnr'];
  12.     $bynavn = $_POST['bynavn'];
  13.     $land = $_POST['land'];
  14.     $email = $_POST['email'];
  15.     $tlf = $_POST['tlf'];
  16.    
  17.     //$db->query("INSERT INTO kunder(firmanavn, adresse, postnr, bynavn, land, email, tlf) VALUES ('$firmanavn','$adresse','$postnr','$bynavn','$land','$email','$tlf') ");
  18.     $db->query("UPDATE kunder SET firmanavn='$firmanavn', adresse='$adresse', postnr='$postnr', bynavn='$bynavn',land='$land', email='$email', tlf='$tlf' WHERE ID = '$kundeid'");
  19.    
  20.     //$kundeid = $db->insert_id;
  21.    
  22.     header('Location: viskunde.php?kundeid=' . $kundeid);
  23.     exit();
  24. }
  25.  
  26. // Start vores side.
  27. $aktiv_menu = 'kunder';
  28. include('templates/side_start.php');
  29.  
  30. ?>
  31. <h3>Ret kundeoplysninger:</h3>
  32.  
  33. <form action='retkunde.php' method='post'>
  34. <?php
  35. $resultat = $db->query("SELECT * FROM kunder WHERE id = '".$_GET['kundeid']."'");
  36.  
  37. if ($kunde = $resultat->fetch_array() ) {
  38.     $kundeid = $kunde['ID'];
  39.     $firmanavn = $kunde['firmanavn'];
  40.     $adresse = $kunde['adresse'];
  41.     $postnr = $kunde['postnr'];
  42.     $bynavn = $kunde['bynavn'];
  43.     $land = $kunde['land'];
  44.     $email = $kunde['email'];
  45.     $tlf = $kunde['tlf'];
  46.    
  47.  
  48.     echo "<table border='1'>";
  49.  
  50.     // Kunde ID som vi retter
  51.     echo "<input type='hidden' name='kundeid' value='$kundeid'>";
  52.     echo "<tr>";
  53.     echo "<td class='tabel-label'>Kunde id</td>";
  54.     echo "<td class='tabel-felt'><input type='text' value='$kundeid' disabled></td>";
  55.     echo "</tr>";
  56.    
  57.     // Firmanavn
  58.     echo "<tr>";
  59.     echo "<td class='tabel-label'>Firmanavn</td>";
  60.     echo "<td class='tabel-felt'><input type='text' name='firmanavn' value='$firmanavn'></td>";
  61.     echo "</tr>";
  62.    
  63.     // Adresse
  64.     echo "<tr>";
  65.     echo "<td class='tabel-label'>Adresse</td>";
  66.     echo "<td class='tabel-felt'><textarea  name='adresse'>$adresse</textarea></td>";
  67.     echo "</tr>";
  68.    
  69.     // Postnummer
  70.     echo "<tr>";
  71.     echo "<td class='tabel-label'>Postnummer</td>";
  72.     echo "<td class='tabel-felt'><input type='text' name='postnr' value='$postnr'></td>";
  73.     echo "</tr>";
  74.    
  75.     // By
  76.     echo "<tr>";
  77.     echo "<td class='tabel-label'>By</td>";
  78.     echo "<td class='tabel-felt'><input type='text' name='bynavn' value='$bynavn'></td>";
  79.     echo "</tr>";
  80.    
  81.     // Land
  82.     echo "<tr>";
  83.     echo "<td class='tabel-label'>Land</td>";
  84.     echo "<td class='tabel-felt'><input type='text' name='land' value='$land'></td>";
  85.     echo "</tr>";
  86.    
  87.     // Email
  88.     echo "<tr>";
  89.     echo "<td class='tabel-label'>E-mail</td>";
  90.     echo "<td class='tabel-felt'><input type='text' name='email' value='$email'></td>";
  91.     echo "</tr>";
  92.    
  93.     // Telefon
  94.     echo "<tr>";
  95.     echo "<td class='tabel-label'>Telefon</td>";
  96.     echo "<td class='tabel-felt'><input type='text' name='tlf' value='$tlf'></td>";
  97.     echo "</tr>";
  98.  
  99.     echo "</table>";
  100.     echo "<input type='submit' value='Gem oplysninger'>";
  101.  
  102.    
  103. } else {
  104.     echo "Kunde ikke fundet.";
  105. }
  106. ?>
  107. </form>
  108. <?
  109. // Slut på vores side.
  110. include('templates/side_slut.php');
  111. ?>
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