<?php include("../cn.php");
$id = $_REQUEST["id"];

$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);
	$imgsql = "Photo='$photo',";

}
mysqli_query($connect, "UPDATE `cars` set $imgsql `Title`='$carname', `Model`='$model',`Brand` = '$brandname', 
`Rate`='$dailyrate' where id='$id'");

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

?>