<?php

include "../config/db.php";

$id = $_POST['id'];
$title = $_POST['title'];
$description = $_POST['description'];

$image = $_FILES['image']['name'];

if($image != ""){

    $tmp = $_FILES['image']['tmp_name'];

    move_uploaded_file($tmp, "../uploads/" . $image);

    $sql = "UPDATE site_content
            SET title='$title',
                description='$description',
                image='$image'
            WHERE id='$id'";

}else{

    $sql = "UPDATE site_content
            SET title='$title',
                description='$description'
            WHERE id='$id'";
}

mysqli_query($con, $sql);

header("Location: edit_about.php");

?>