Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $uname = "root";
- $pass = "root";
- $host = "localhost";
- $dbname = "kontaktform";
- $username = $_POST['Namn'];
- $email = $_POST['Emailadress'];
- $comment = $_POST['inlagg'];
- $connection = new mysqli($host, $uname, $pass, $dbname);
- if ( $connection -> connect_error )
- {
- die (" Connection failed : ". $connection . connect_error ) ;
- }
- echo " Connection worked .";
- $sql = "INSERT INTO users (namn, epost, kommentar)
- VALUES ('$username', '$email', '$comment')";
- if ($connection ->query($sql) === TRUE) {
- echo "worked";
- }
- else {
- echo "try again". $sql. "<br>". $connection->error;
- }
- $connection->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement