0byt3m1n1
Path:
/
var
/
www
/
listcrawler.app
/
public_html
/
admin
/
[
Home
]
File: edit_location_info.php
<?php session_start(); require_once 'config/config.php'; require_once BASE_PATH.'/includes/auth_validate.php'; // Sanitize if you want $location_info_id = filter_input(INPUT_GET, 'location_info_id', FILTER_VALIDATE_INT); $operation = filter_input(INPUT_GET, 'operation', FILTER_SANITIZE_STRING); ($operation == 'edit') ? $edit = true : $edit = false; $db = getDbInstance(); // Handle update request. As the form's action attribute is set to the same script, but 'POST' method, if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Get list_id id form query string parameter. $location_info_id = filter_input(INPUT_GET, 'location_info_id', FILTER_SANITIZE_STRING); // Get input data $data_to_db = filter_input_array(INPUT_POST); $listdata_to_db = array( 'title' => trim($data_to_db['title']), 'detail' => trim($data_to_db['detail']), 'is_active' => $data_to_db['is_active'], 'title_city' => trim($data_to_db['title_city']), 'meta_desc_city' => trim($data_to_db['meta_desc_city']), 'meta_key_city' => trim($data_to_db['meta_key_city']), ); $db = getDbInstance(); $db->where('id', $location_info_id); $stat = $db->update('location_info', $listdata_to_db); if ($stat) { $_SESSION['success'] = 'updated successfully!'; // Redirect to the edit page header('Location: edit_location_info.php?location_info_id=' . $location_info_id . '&operation=edit'); // Important! Don't execute the rest put the exit/die. exit(); } } // If edit variable is set, we are performing the update operation. if ($edit) { $db->where('id', $location_info_id); // Get data to pre-populate the form. $location_info = $db->getOne('location_info'); //echo "<pre>"; $getLocation = $db->rawQueryOne("SELECT `location_name` FROM `locations` WHERE `id` = " . $location_info['location_id'] . " LIMIT 1 "); //print_r($getLocations); } ?> <?php include BASE_PATH.'/includes/header.php'; ?> <div id="page-wrapper"> <div class="row"> <div class="col-lg-6"> <h2 class="page-header">Update Location Info & Meta Content</h2> </div> <div class="col-lg-6"> <div class="page-action-links text-right"> <a href="location_info.php" class="btn btn-success"><i class="glyphicon glyphicon-chevron-left"></i> Location Info & Meta Content</a> </div> </div> </div> <!-- Flash messages --> <?php include BASE_PATH.'/includes/flash_messages.php'; ?> <form class="form" action="" method="post" id="location_info_form" enctype="multipart/form-data"> <?php include BASE_PATH.'/forms/location_info_form.php'; ?> </form> </div> <script type="text/javascript"> /*$(document).ready(function(){ $('#location_info_form').validate({ rules: { title: { required: true, minlength: 3 }, detail: { required: true, minlength: 3 } } }); });*/ </script> <?php include BASE_PATH.'/includes/footer.php'; ?>