Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <form method="POST" action="post.php" style="font-
  2. size:200%;padding:50px">
  3. <label for="comments">Comments:</label>
  4. <textarea class="form-control" placeholder="How can I improve?"
  5. style="background-color:#fff4c9;border-radius:15px;width:100%;"
  6. name="comments" rows="5" id="comments" value=""></textarea> <br>
  7. <button type="submit" class="btn btn-default">Share Your Ideas</button>
  8. </form>`
  9.  
  10. <?php
  11. if($_SERVER["REQUEST_METHOD"] == "POST") {
  12. $servername = "localhost";
  13. $username = "id1403626_wp_4764008ac42f7398450c24184e47c38a";
  14. $password = "Marshall2";
  15. $dbname = "id1403626_wp_257ecd760342ffcefce424435ed4e776";
  16. //Collect Value of Input Field
  17. $name = $_POST['comments'];
  18. $timestamp = date('Y-m-d H:i:sa');
  19.  
  20. //Create connection
  21. $connect = mysqli_connect($servername, $username, $password);
  22.  
  23. //Check connection
  24. if ($connect->connect_error) {
  25. die("So here's the problem...:".$connect->connect_error);
  26. }
  27. //Select Database
  28. mysqli_select_db($connect,$dbname)
  29. or die("Whoops! Can't find that pesky database!");
  30. //Insert Data Query
  31. $sql = "INSERT INTO `Comments`(`comments`, `date`) VALUES ($name,
  32. $timestamp)";
  33. //What should happen
  34. $result = mysqli_query($connect, $sql);
  35.  
  36. if($result){
  37. echo 'thank you for your feed back';
  38. }else {
  39. echo "Fuck man I can't code this shit right. If you have a comment email
  40. it to me at philobythekilo@gmail.com I'ma get this shit working one of
  41. these days.";
  42. }
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement