<?php include("../cn.php");
$carname = $_REQUEST["title"];
$model = $_REQUEST["model"];
$brandname = $_REQUEST["brand"];
$dailyrate = $_REQUEST["rate"];
$img_name = date("Ymdis");
$photo=($_FILES["photo"]["name"]!="")?"cars/cars_".$img_name.".".pathinfo($_FILES['photo']['name'], PATHINFO_EXTENSION):"";
if($_FILES["photo"]["name"]!="")
{
    move_uploaded_file($_FILES["photo"]["tmp_name"],"../".$photo);

}
mysqli_query($connect, "INSERT INTO `cars`(`Title`, `Model`, `Rate`, `Image`, `Brand`) VALUES(
 '$carname','$model','$dailyrate','$photo','$brandname')");


header("location:../cars.php");

?>