hi all,
i am creating a session variable on the property_detail.php page
where after updating all the values i redirected the use to the same page with the value in the session to be printed on the same page
as "Property details saved successfully".
but the problem is when i use redirect and prints the value of the
session like this.
echo $_session['msg']"; unset($_session['msg'])
i want to remove the session after displaying the message to the user. but when i removes the
unset($_session['msg'])
the message is being appear on the same page.
but with
unset
it's not running.
Please help.
<?php if ($_SESSION['msg']) { ?>
<div class="success_message"><?php echo $_SESSION['msg']; if ($_SESSION['msg'])unset($_SESSION['msg']);?></div>
<?php } ?>
<?php
/* check sesison */
require_once('chksession.php');
require_once ('includes/dbconfig.php');
/* get all the details of property */
$rs1 = $db->fnSelect('tbl_hotel','*','id='.$_SESSION['pid']) or die('There is some technical problem');
?>
<?php
/* update all the property details */
if ($_POST['action']=='save') {
/** check all the values those are required on the server side */
require_once('includes/class/validation.class.php');
$location = htmlspecialchars(strip_tags($_POST['location_name']));
$beach = htmlspecialchars(strip_tags($_POST['beach']));
$propertyname = htmlspecialchars(strip_tags($_POST['property_name']));
$acc_type = htmlspecialchars(strip_tags($_POST['acc_type']));
$address = htmlspecialchars(strip_tags($_POST['street_address']));
$owner = htmlspecialchars(strip_tags($_POST['owner']));
$website_url = htmlspecialchars(strip_tags($_POST['website_url']));
$t = "NOW()";
/* initialize obj object for validation */
$obj = new PhpServerValidation();
$obj->fnGetFields($location,'req','Location name is required');
$obj->fnGetFields($propertyname,'req','Property name is required');
$obj->fnGetFields($acc_type,'req','Accomodation Type is required');
$obj->fnGetFields($address,'req','Steet Address is required');
$obj->fnGetFields($owner,'req','Authority is required');
/* validate all the fields */
$error = $obj->fnFieldsvalidation();
/* if there is an error display it out */
if (!empty($error)) {
$error_msg = '<UL>'.$error.'</UL>';
}
/* update all the fields */
else {
$loc = array();
$loc = explode("::",$location);
/* check if checkboxes values are preset */
if ($_POST['chk']) {
/* make a string of all the features */
$fe = implode(",",$_POST['chk']);
} else {
$fe = '';
}
$fields = "name='$propertyname',location_zone='$loc[0]',location_area='$loc[1]',address='$address',beach='$beach',property_type ='$acc_type',owner='$owner',features='$fe',date_time=$t";
$condition = 'id='.$_SESSION['pid'];
//update the values into table
$outputupdate = $db->fnUpadte('tbl_hotel',$fields,$condition);
if ($outputupdate) {
$_SESSION['msg'] = "* Property details updated successfully";
header('location:property_details.php?pid='.$_SESSION['pid']);
}
}
}
?>