<!DOCTYPE html> <html> <head> <title>Thanks for Joining</title> <meta charset="UTF-8"> <meta name="description" content=""> <meta name="keywords" content=""> <link rel="stylesheet" href="bootstrap.css"> <link rel="stylesheet" href="style.css"> </head> <body> <?php $dsn = "mysql:host=localhost;dbname=proferik_Demo"; $username = "proferik_teacher"; $password = "Pa55word"; $db = new PDO($dsn, $username, $password); //$host = "localhost"; //$username = "proferik_teacher"; //$password = "Pa55word"; //$dbName = "proferik_Demo"; // $db = mysqli_connect($host, $username, $password, $dbName); $fn = $_POST['firstName']; $ln = $_POST['lastName']; $car= $_POST['cars']; $html = $_POST['html']; $sql = "INSERT INTO tblDemo (first_name, last_name, cars, html_feelings) VALUES ('$fn','$ln','$car','$html' )"; ?> <section class="container output"> <h1><?php //$result= mysqli_query($db,$sql); $result = $db->exec($sql); if($result){ echo ("yay, it worked"); } else { die("fail".mysqli_error($db)); } ?></h1> <pre><?php print_r($_POST); ?></pre> <p>Hey <?php echo( $fn )?> thanks for joining</p> <h1><?php echo($fn." ".$ln." ".$car." ".$html) ?></h1> <h2><a href="Results.php">View Results</a></h2> </section> </body> </html>