Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="action_page.php">
- <div class="first">
- <textarea name="first">tekst goes here</textarea>
- </div>
- <div class="second">
- <textarea name="second">tekst goes here</textarea>
- </div>
- <div class="button">
- <input type="submit">
- </div>
- </form>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "password";
- $dbname = "mydb";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $sql = "INSERT INTO mydb(firstText, secndText)
- VALUES ('something', 'something')";
- $conn->exec($sql);
- echo "New record created successfully";
- }
- catch(PDOException $e)
- {
- echo $sql . "<br>" . $e->getMessage();
- }
- $conn = null;
- ?>
Add Comment
Please, Sign In to add comment