Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Sep 2nd, 2010 | Syntax: None | Size: 1.19 KB | Hits: 235 | Expires: Never
Copy text to clipboard
  1. <html>
  2. <head>
  3. <title>Guestbook<title>
  4. <link rel="stylesheet" type="text/css" href="style.css" />
  5. <?php
  6. $lank = mysql_connect("localhost","root","pixiaxp")
  7.         or die ("kunde inte ansluta");
  8. print ("Ansluten!");
  9. ?>
  10.  
  11. <?php
  12.         $namn = $_POST['namn'];
  13.         $meddelande = $_POST['meddelande'];
  14.         $lank = mysql_connect("localhost","root","pixiaxp");
  15.         $databas = mysql_select_db("gb");
  16.         $sql = "INSERT INTO inlagg(namn,inlagg) VALUES ('$namn','$meddelande')";
  17.         mysql_query("$sql");
  18. ?>
  19.  
  20. </head>
  21. <body>
  22. <h1> Nicklas Gastbok! </h1>
  23.  
  24. <div id="header">
  25.         <div id="input">
  26. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  27. <h1>Namn</h1> <input type ="text" name="namn"><BR><BR>
  28. <h1>Meddelande</h1> <textarea name="meddelande" cols="20" rows="7"></textarea><BR><BR>
  29. <input type="submit" value="Okej">
  30. </form>
  31.         </div>
  32. </div>
  33. <BR>
  34. <?
  35.         $databas = mysql_select_db("gb");
  36.         $resultat = mysql_query("SELECT * FROM inlagg");
  37.  
  38.         while ($rad = mysql_fetch_array($resultat)){ ?>
  39.         <div id="inlagg">
  40.                 <div id="input">
  41.  
  42.          <h1>Inlagg # <? echo $rad[id]; ?></h1>
  43.          Fran: <? echo $rad[name]; ?><br>
  44.          Meddelande:<br> <? echo $rad[inlagg]; ?>
  45.         </div></div><BR>
  46. <?     
  47.         }
  48. ?>
  49. </div>
  50. </body>
  51. </html>