Current File : /home/bassmoto/www/admin/edit-vehicle.php |
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if (isset($_SESSION['alogin']) && strlen($_SESSION['alogin']) == 0)
{
header('location:index.php');
}
else{
if(isset($_POST['submit']))
{
$vehicletitle=$_POST['vehicletitle'];
$brand=$_POST['brandname'];
$vehicleoverview=$_POST['vehicalorcview'];
$price=$_POST['price'];
$saletype=$_POST['saletype'];
$modelyear=$_POST['modelyear'];
$miles=$_POST['miles'];
$vinnum=$_POST['vinnum'];
$transmission=$_POST['transmission'];
$vtype=$_POST['vtype'];
$extcolor=$_POST['extcolor'];
$intcolor=$_POST['intcolor'];
$id=intval($_GET['id']);
$sql="update tblvehicles set VehiclesTitle=:vehicletitle,VehiclesBrand=:brand,VehiclesOverview=:vehicleoverview,Price=:price,SaleType=:saletype,ModelYear=:modelyear,Miles=:miles,VinNum=:vinnum,Transmission=:transmission,Vtype=:vtype,ExtColor=:extcolor,IntColor=:intcolor where id=:id ";
$query = $dbh->prepare($sql);
$query->bindParam(':vehicletitle',$vehicletitle,PDO::PARAM_STR);
$query->bindParam(':brand',$brand,PDO::PARAM_STR);
$query->bindParam(':vehicleoverview',$vehicleoverview,PDO::PARAM_STR);
$query->bindParam(':price',$price,PDO::PARAM_STR);
$query->bindParam(':saletype',$saletype,PDO::PARAM_STR);
$query->bindParam(':modelyear',$modelyear,PDO::PARAM_STR);
$query->bindParam(':miles',$miles,PDO::PARAM_STR);
$query->bindParam(':vinnum',$vinnum,PDO::PARAM_STR);
$query->bindParam(':transmission',$transmission,PDO::PARAM_STR);
$query->bindParam(':vtype',$vtype,PDO::PARAM_STR);
$query->bindParam(':extcolor',$extcolor,PDO::PARAM_STR);
$query->bindParam(':intcolor',$intcolor,PDO::PARAM_STR);
$query->bindParam(':id',$id,PDO::PARAM_STR);
$query->execute();
$msg="Data updated successfully";
}
?>
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="theme-color" content="#3e454c">
<title>Bass Motorsports | Admin Edit Vehicle Info</title>
<!-- Font awesome -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<!-- Sandstone Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Bootstrap Datatables -->
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<!-- Bootstrap social button library -->
<link rel="stylesheet" href="css/bootstrap-social.css">
<!-- Bootstrap select -->
<link rel="stylesheet" href="css/bootstrap-select.css">
<!-- Bootstrap file input -->
<link rel="stylesheet" href="css/fileinput.min.css">
<!-- Awesome Bootstrap checkbox -->
<link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css">
<!-- Admin Stye -->
<link rel="stylesheet" href="css/style.css">
<style>
.errorWrap {
padding: 10px;
margin: 0 0 20px 0;
background: #fff;
border-left: 4px solid #dd3d36;
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
}
.succWrap{
padding: 10px;
margin: 0 0 20px 0;
background: #fff;
border-left: 4px solid #5cb85c;
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
}
</style>
</head>
<body>
<?php include('includes/header.php');?>
<div class="ts-main-content">
<?php include('includes/leftbar.php');?>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="page-title">Edit Vehicle</h2>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Basic Info</div>
<div class="panel-body">
<?php if($msg){?><div class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php } ?>
<?php
$id=intval($_GET['id']);
$sql ="SELECT tblvehicles.*,tblbrands.BrandName,tblbrands.id as bid from tblvehicles join tblbrands on tblbrands.id=tblvehicles.VehiclesBrand where tblvehicles.id=:id";
$query = $dbh -> prepare($sql);
$query-> bindParam(':id', $id, PDO::PARAM_STR);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $result)
{ ?>
<form method="post" class="form-horizontal" enctype="multipart/form-data">
<div class="form-group">
<label class="col-sm-2 control-label">Vehicle Title<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="vehicletitle" class="form-control" value="<?php echo htmlentities($result->VehiclesTitle)?>" required>
</div>
<label class="col-sm-2 control-label">Select Brand<span style="color:red">*</span></label>
<div class="col-sm-4">
<select class="selectpicker" name="brandname" required>
<option value="<?php echo htmlentities($result->bid);?>"><?php echo htmlentities($bdname=$result->BrandName); ?> </option>
<?php $ret="select id,BrandName from tblbrands";
$query= $dbh -> prepare($ret);
//$query->bindParam(':id',$id, PDO::PARAM_STR);
$query-> execute();
$resultss = $query -> fetchAll(PDO::FETCH_OBJ);
if($query -> rowCount() > 0)
{
foreach($resultss as $results)
{
if($results->BrandName==$bdname)
{
continue;
} else{
?>
<option value="<?php echo htmlentities($results->id);?>"><?php echo htmlentities($results->BrandName);?></option>
<?php }}} ?>
</select>
</div>
</div>
<div class="hr-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">Vehical Overview<span style="color:red">*</span></label>
<div class="col-sm-10">
<textarea class="form-control" name="vehicalorcview" rows="3" required><?php echo htmlentities($result->VehiclesOverview);?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Price (in USD)</label>
<div class="col-sm-4">
<input type="text" name="price" class="form-control" value="<?php echo htmlentities($result->Price);?>">
</div>
<label class="col-sm-2 control-label">Select SaleType<span style="color:red">*</span></label>
<div class="col-sm-4">
<select class="selectpicker" name="saletype" required>
<option value="<?php echo htmlentities($result->SaleType);?>"><?php echo htmlentities($result->SaleType);?></option>
<option value="On Sale">On Sale</option>
<option value="Sold">Sold</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Model Year<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="modelyear" class="form-control" value="<?php echo htmlentities($result->ModelYear);?>" required>
</div>
<label class="col-sm-2 control-label">Milage<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="miles" class="form-control" value="<?php echo htmlentities($result->Miles);?>" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">VIN Number<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="vinnum" class="form-control" value="<?php echo htmlentities($result->VinNum);?>" required>
</div>
<label class="col-sm-2 control-label">Transmission<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="transmission" class="form-control" value="<?php echo htmlentities($result->Transmission);?>" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Type<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="vtype" class="form-control" value="<?php echo htmlentities($result->Vtype);?>" required>
</div>
<label class="col-sm-2 control-label">Exterior Color<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="extcolor" class="form-control" value="<?php echo htmlentities($result->ExtColor);?>" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Interior Color<span style="color:red">*</span></label>
<div class="col-sm-4">
<input type="text" name="intcolor" class="form-control" value="<?php echo htmlentities($result->IntColor);?>" required>
</div>
</div>
<div class="hr-dashed"></div>
<div class="form-group">
<div class="col-sm-12">
<h4><b>Vehicle Images</b></h4>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 1 <img src="img/vehicleimages/<?php echo htmlentities($result->Vimage1);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage1.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 1</a>
</div>
<div class="col-sm-4">
Image 2<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage2);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage2.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 2</a>
</div>
<div class="col-sm-4">
Image 3<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage3);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage3.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 3</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 4<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage4);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage4.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 4</a>
</div>
<div class="col-sm-4">
Image 5<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage5);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage5.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 5</a>
</div>
<div class="col-sm-4">
Image 6<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage6);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage6.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 6</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 7<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage7);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage7.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 7</a>
</div>
<div class="col-sm-4">
Image 8<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage8);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage8.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 8</a>
</div>
<div class="col-sm-4">
Image 9<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage9);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage9.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 9</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 10<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage10);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage10.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 10</a>
</div>
<div class="col-sm-4">
Image 11<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage11);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage11.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 11</a>
</div>
<div class="col-sm-4">
Image 12<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage12);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage12.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 12</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 13<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage13);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage13.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 13</a>
</div>
<div class="col-sm-4">
Image 14<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage14);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage14.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 14</a>
</div>
<div class="col-sm-4">
Image 15<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage15);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage15.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 15</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 16<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage16);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage16.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 16</a>
</div>
<div class="col-sm-4">
Image 17<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage17);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage17.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 17</a>
</div>
<div class="col-sm-4">
Image 18<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage18);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage18.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 18</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 19<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage19);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage19.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 19</a>
</div>
<div class="col-sm-4">
Image 20<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage20);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage20.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 20</a>
</div>
<div class="col-sm-4">
Image 21<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage21);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage21.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 21</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 22<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage22);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage22.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 22</a>
</div>
<div class="col-sm-4">
Image 23<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage23);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage23.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 23</a>
</div>
<div class="col-sm-4">
Image 24<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage24);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage24.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 24</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 25<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage25);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage25.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 25</a>
</div>
<div class="col-sm-4">
Image 26<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage26);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage26.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 26</a>
</div>
<div class="col-sm-4">
Image 27<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage27);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage27.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 27</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
Image 28<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage28);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage28.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 28</a>
</div>
<div class="col-sm-4">
Image 29<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage29);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage29.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 29</a>
</div>
<div class="col-sm-4">
Image 30<img src="img/vehicleimages/<?php echo htmlentities($result->Vimage30);?>" width="300" height="200" style="border:solid 1px #000">
<a href="changeimage30.php?imgid=<?php echo htmlentities($result->id)?>">Change Image 30</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-12" >
<button class="btn btn-primary" name="submit" type="submit" style="margin-top:20px;width:150px;font-size:13px;">Save changes</button>
</div>
</div>
</div>
<div class="hr-dashed"></div>
</div>
</div>
</div>
</div>
<?php }} ?>
</form>
</div>
</div>
<!-- Loading Scripts -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<script src="js/fileinput.js"></script>
<script src="js/chartData.js"></script>
<script src="js/main.js"></script>
</body>
</html>
<?php } ?>