Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="post.php" style="font-
- size:200%;padding:50px">
- <label for="comments">Comments:</label>
- <textarea class="form-control" placeholder="How can I improve?"
- style="background-color:#fff4c9;border-radius:15px;width:100%;"
- name="comments" rows="5" id="comments" value=""></textarea> <br>
- <button type="submit" class="btn btn-default">Share Your Ideas</button>
- </form>`
- <?php
- if($_SERVER["REQUEST_METHOD"] == "POST") {
- $servername = "localhost";
- $username = "id1403626_wp_4764008ac42f7398450c24184e47c38a";
- $password = "Marshall2";
- $dbname = "id1403626_wp_257ecd760342ffcefce424435ed4e776";
- //Collect Value of Input Field
- $name = $_POST['comments'];
- $timestamp = date('Y-m-d H:i:sa');
- //Create connection
- $connect = mysqli_connect($servername, $username, $password);
- //Check connection
- if ($connect->connect_error) {
- die("So here's the problem...:".$connect->connect_error);
- }
- //Select Database
- mysqli_select_db($connect,$dbname)
- or die("Whoops! Can't find that pesky database!");
- //Insert Data Query
- $sql = "INSERT INTO `Comments`(`comments`, `date`) VALUES ($name,
- $timestamp)";
- //What should happen
- $result = mysqli_query($connect, $sql);
- if($result){
- echo 'thank you for your feed back';
- }else {
- echo "Fuck man I can't code this shit right. If you have a comment email
- it to me at philobythekilo@gmail.com I'ma get this shit working one of
- these days.";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement