try {
$db = new PDO('mysql:host=localhost;dbname=idegraphics', 'root', '');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
$radio=$_POST["radio1"];
$descr=$_POST["descr"];
$yrreg=$_POST["select"];
$carmodel=$_POST["mot"];
$fuel=$_POST["fuel"];
$variant=$_POST["variant"];
try {
$stmt = $db->prepare("insert into motorscustomer(cardetails,registartiondetails,yearofregistation,cardetailsname,fueltype,variantype)
values(?,?,?,?,?,?)");
$stmt->execute(array($radio,$descr,$yrreg,$carmodel,$fuel,$variant));
$last_id = $db->lastInsertId();
// echo "New record created successfully. Last inserted ID is: " . $last_id;
}catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}