Advertisement
Guest User

Untitled

a guest
Jul 17th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>GutMood - created to make you happy</title>
  5.  
  6. <link href="styles.css" rel="stylesheet" type="text/css">
  7. <link href="css/post.css" rel="stylesheet" type="text/css">
  8. </head>
  9. <body>
  10.  
  11. <div id="postdiv">
  12. <a href="index.php" ><img id="backbut" src="img/backbut.svg" /></a>
  13.  
  14. <h1>Submit a quote yourself</h1>
  15. <form name="skip" action="?" method="post">
  16. <input id="quotetext" name="thequote" type="text" value="The quote" onclick="javascript: this.value = ''"><br />
  17.  
  18. <input id="subquote" name="submit" type="submit" value="Submit your quote">
  19. </form>
  20. <h3>Sorry, this feature doesn't work yet</h3>
  21.  
  22. <a href="bug-report.php" title="Report a (lady)bug"><img id="bugreport" src="img/bug.svg" /></a>
  23. </div>
  24.  
  25. <?php
  26.     if($_POST){
  27.         try {
  28.             $pdo = new PDO('mysql:host=localhost;dbname=database;charset=utf8', 'brugernavn', 'kodeord',
  29.                 array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
  30.             $stmt = $pdo->prepare("INSERT INTO temp(quote) VALUES (:quote)");
  31.             $stmt->execute(array(':quote' => $_POST['thequote']));
  32.             echo "Weee quote inserted!";
  33.  
  34.         } catch (Exception $e) {
  35.             echo "Something went wrong: ".$e->getMessage();
  36.         }
  37.     }
  38. ?>
  39.  
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement