<?php
session_start();
require("config.php");
$error="";
$msg="";
if(!isset($_SESSION['auser'])){
header("location:index.php");
}
if(isset($_POST['add'])){
$pid=$_REQUEST['id'];
$Name=$_POST['Name'];
$contact=$_POST['contact'];
$address=$_POST['address'];
$refrance=$_POST['refrance'];
$leadtype=$_POST['Leadtype'];
$payment=$_POST['payment'];
$paymenttype=$_POST['paymenttype'];
$sql="UPDATE property SET Name='{$Name}',contact='{$contact}',address='{$address}',refrance='{$refrance}',leadtype='{$leadtype}',payment='{$payment}',paymenttype='{$paymenttype}' WHERE pid={$pid}";
$result=mysqli_query($con,$sql);
if($result==true){
$msg="<p class='alert alert-success'>Property Updated</p>";
header("Location:propertyview.php?msg=$msg");
}else{
$msg="<p class='alert alert-warning'>Property Not Updated</p>";
header("Location:propertyview.php?msg=$msg");
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0">
<title>Clan Homes</title>
<link rel="shortcut icon" type="image/x-icon" href="assets/img/favicon.png">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/feathericon.min.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php include("header.php");?>
<div class="page-wrapper">
<div class="content container-fluid">
<div class="page-header">
<div class="row">
<div class="col">
<h3 class="page-title">Apartments</h3>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
<li class="breadcrumb-item active">Apartments</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Update Apartments Details</h4>
<?php echo $error;?>
<?php echo $msg;?>
</div>
<form method="post" enctype="multipart/form-data">
<?php
$pid=$_REQUEST['id'];
$query=mysqli_query($con,"select * from property where pid='$pid'");
while($row=mysqli_fetch_row($query)){
?>
<div class="card-body">
<h5 class="card-title">Apartments Detail</h5>
<div class="row">
<div class="col-xl-12">
<div class="form-group row">
<label class="col-lg-2 col-form-label">Title</label>
<div class="col-lg-9">
<input type="text" class="form-control" name="title" required value="<?php echo $row['1'];?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label">Content</label>
<div class="col-lg-9">
<textarea class="tinymce form-control" name="content" rows="10" cols="30"><?php echo $row['3'];?></textarea>
</div>
</div>
</div>
<div class="col-xl-6">
<div class="form-group row">
<label class="col-lg-3 col-form-label">Name</label>
<div class="col-lg-9">
<input type="text" class="form-control" name="Name" required value="<?php echo $row['2'];?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Contact</label>
<div class="col-lg-9">
<input type="text" class="form-control" name="contact" required value="<?php echo $row['9'];?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Refrance</label>
<div class="col-lg-9">
<input type="text" class="form-control" name="refrance" required value="<?php echo $row['4'];?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Lead Type</label>
<div class="col-lg-9">
<select class="form-control" required name="Leadtype">
<option value="">Select Type</option>
<option value="Walk-In">Walk-In</option>
<option value="Facebook">Facebook</option>
<option value="Instagram">Instagram</option>
<option value="Tiktok">Tiktok</option>
<option value="Youtube">Youtube</option>
<option value="Cold-Call">Cold Call</option>
</select>
</div>
</div>
</div>
<div class="col-xl-6">
<div class="form-group row">
<label class="col-lg-3 col-form-label">Type</label>
<div class="col-lg-9">
<select class="form-control" required name="paymenttype">
<option value="">Payment Type</option>
<option value="Cash">Cash</option>
<option value="Cheque">Cheque</option>
<option value="Online">Online</option>
<option value="DD / Pay Order">DD / Pay Order</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Address</label>
<div class="col-lg-9">
<input type="text" class="form-control" name="address" required value="<?php echo $row['8'];?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label">Down Payment</label>
<div class="col-lg-9">
<input type="text" class="form-control" name="payment" required value="<?php echo $row['6'];?>">
</div>
</div>
</div>
</div>
<input type="submit" value="Submit" class="btn btn-primary" name="add" style="margin-left:200px;">
</div>
</form>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/jquery-3.2.1.min.js"></script>
<script src="assets/plugins/tinymce/tinymce.min.js"></script>
<script src="assets/plugins/tinymce/init-tinymce.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>
