<?php
error_reporting(0);
session_start();
include '../include/connection.php';
$conn     = db();
@extract($_REQUEST);
$folder='../upload/location/';
$file=time().@str_replace(' ','-',$_FILES['image']['name']);
if(move_uploaded_file(@$_FILES['image']['tmp_name'],$folder.$file))
{
$image=$file;
}
$page_url_link =  preg_replace('/\s+/', '-', strtolower(str_replace('-',' ',$_REQUEST['pg_name'])));
// echo $page_url_link;
$websel=mysqli_query($conn,"select * from tbl_location where location_title='".$page_url_link."'");
if(mysqli_num_rows($websel)==0)
{
$sql="insert into tbl_location set
location_title='".str_replace("'","^",$_REQUEST['pg_name'])."',
description='".str_replace("'","^",$_REQUEST['description'])."',
pg_status='".$_REQUEST['pg_status']."',
location_map='".$_REQUEST['loc_map']."',
date_time=now(),
image='".$image."'";
if(mysqli_query($conn,$sql))
{
$_SESSION['add-page-msg']="Add Successfully";
}
}
else
{
$_SESSION['add-page-errormsg']="Page Url already exit please take other Page Url";
}
?>
<script>window.location.href='manage-location.php'</script>