Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <form name = "quoted" method="post" onsubmit="get_action(this);">
  2. <input id = "poster" type="text" name="poster" required="required" placeholder = "Credited Individual."> <br>
  3. <textarea class = "actual_quote" name = "actual_quote" required="required" placeholder = "Write the question here!"></textarea><br><br><br>
  4. <div class = "checkboxes" required="required">
  5. <h3 style = "margin-top:-20px;">Please select one catagory that the quote falls into.</h3>
  6. <label for="x"><input type="radio" name="x" value="Inspirational" id = "inspirational.php" checked="checked" /> <span>Inspirational</span></label><br>
  7. <label for="x"><input type="radio" name="x" value="Funny" id = "funny.php" /> <span>Funny</span> </label><br>
  8. <label for="x"><input type="radio" name="x" value="OutofContext" id = "outofcontext.php"/> <span>OutofContext</span></label>
  9. </div>
  10. <input id = "submit1" name="submit1"s type="submit"><br>
  11. </form>
  12.  
  13. <?php
  14. $db_name = 'submissions';
  15. $db_user = 'root';
  16. $db_pass = '';
  17. $db_host = 'localhost';
  18. try {
  19. $db = new PDO('mysql:host = localhost;dbname=submissions', $db_user, $db_pass);
  20. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  21. } catch (PDOException $e) {
  22. echo 'Connection failed: ' . $e->getMessage();
  23. }
  24. $actual_quote = (isset($_POST['actual_quote']) ? $_POST['actual_quote'] : null);
  25. $poster = (isset($_POST['poster']) ? $_POST['poster'] : null);
  26. $sql = "INSERT INTO data (actual_quote, poster) VALUES ( :actual_quote, :poster)";
  27. $query = $db->prepare($sql);
  28. $query->execute(array(':actual_quote'=>$actual_quote, ':poster'=>$poster));
  29. ?>
  30.  
  31. $actual_quote = (isset($_POST['actual_quote']) ? $_POST['actual_quote'] : '');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement