I have a problem I think. My PHP PDO code didn't work at all. I've followed everything maybe in the manual but it seem doesn't work, it just returning a blank page and in my database there are no data at all. Below are my codes for php and I am using Xampp. What i've done wrong?
<?php
if(isset($_POST["submit"])){
$hostname = 'localhost';
$username = 'root';
$password = '';
try{
$dbh = new PDO ("mysql:host=$hostname;dbname=test", $username, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, ERRMODE_EXCEPTION);
$create_params_query = "INSERT INTO testingdb (name, email, message)
VALUES ('".$_POST["name"]."', '".$_POST["email"]."', '".$_POST["message"]."')";
if($dbh->query($sqlite)){
echo "<script type= 'text/javascript'>alert('You're data has been sent. Thank you!');</script>";
}else{
echo "<script type= 'text/javascript'>alert('Sorry, you're data not being sent. Please try again.');</script>";
}
}catch (PDOException $e){
echo $e->getMessage();
}
}
$dbh = null;
?>