Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dsn = '';
- $user = '';
- $password = '';
- try {
- $dbh = new PDO($dsn, $user, $password);
- } catch (PDOException $e) {
- echo 'Connection failed: ' . $e->getMessage();
- }
- ?>
- <?php
- require 'mysqli_connect.php';
- if(isset($_POST['submit']) && !empty($_POST['submit'])){
- $sth = $dbh->prepare('INSERT INTO test_table(comment) VALUES(?);');
- $comment = $_POST['comment'];
- $sth->execute(Array($comment));
- }
- ?>
- <form action = "<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" method = "post">
- <p>Comment</p>
- <textarea name= "comment" rows="6" cols="50"></textarea><br />
- <input type="submit" name= "submit" value="submit" id = "submit">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement