<?php
error_reporting(0);
session_start();
include '../include/connection.php';
$conn     = db();
@extract($_REQUEST);
$folder='../upload/location/';

if($_FILES['image']['name'])
{
$file=time().@str_replace(' ','-',$_FILES['image']['name']);
if(move_uploaded_file(@$_FILES['image']['tmp_name'],$folder.$file))
{
$image=$file;
}
}
else
{
$websel=mysqli_query($conn,"select * from tbl_location where location_id='".$_REQUEST['id']."'");
$webres=mysqli_fetch_array($websel);
$image=$webres['image'];
}
$page_url_link =  preg_replace('/\s+/', '-', strtolower(str_replace('-',' ',$_REQUEST['location_title'])));
$sql="update tbl_location set
location_title='".str_replace("'","^",$_REQUEST['pg_name'])."',
location_map='".str_replace("'","^",$_REQUEST['loc_map'])."',
description='".str_replace("'","^",$_REQUEST['description'])."',
pg_status='".$_REQUEST['pg_status']."',
image='".$image."' where location_id='".$_REQUEST['id']."'";
if(mysqli_query($conn,$sql))
{
$_SESSION['page-msg']="update Successfully";
?>
<script>window.location.href='manage-location.php'</script>
<?php } ?>