KEMBAR78
Web System 2 Project | PDF | Airbag | Automotive Technologies
0% found this document useful (0 votes)
21 views50 pages

Web System 2 Project

The document contains code for a Car Rental Portal, including HTML and PHP scripts to display car listings, vehicle details, and customer testimonials. It features a responsive design with Bootstrap and includes sections for banners, recent car listings, fun facts, and customer testimonials. The code also integrates various stylesheets and scripts for enhanced functionality and user experience.

Uploaded by

Joaquim Muhongo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views50 pages

Web System 2 Project

The document contains code for a Car Rental Portal, including HTML and PHP scripts to display car listings, vehicle details, and customer testimonials. It features a responsive design with Bootstrap and includes sections for banners, recent car listings, fun facts, and customer testimonials. The code also integrates various stylesheets and scripts for enhanced functionality and user experience.

Uploaded by

Joaquim Muhongo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Final Exam

Web system II

Name: Joaquim Goncalo Muhongo

Codes

Index code

<?php

session_start();

include('includes/config.php');

error_reporting(0);

?>

<!DOCTYPE HTML>

<html lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width,initial-scale=1">

<meta name="keywords" content="">

<meta name="description" content="">

<title>Car Rental Portal</title>

<!--Bootstrap -->

<link rel="stylesheet" href="assets/css/bootstrap.min.css" type="text/css">

<link rel="stylesheet" href="assets/css/style.css" type="text/css">

<link rel="stylesheet" href="assets/css/owl.carousel.css" type="text/css">


<link rel="stylesheet" href="assets/css/owl.transitions.css" type="text/css">

<link href="assets/css/slick.css" rel="stylesheet">

<link href="assets/css/bootstrap-slider.min.css" rel="stylesheet">

<link href="assets/css/font-awesome.min.css" rel="stylesheet">

<link rel="stylesheet" id="switcher-css" type="text/css"


href="assets/switcher/css/switcher.css" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/red.css"


title="red" media="all" data-default-color="true" />

<link rel="alternate stylesheet" type="text/css"


href="assets/switcher/css/orange.css" title="orange" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/blue.css"


title="blue" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/pink.css"


title="pink" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/green.css"


title="green" media="all" />

<link rel="alternate stylesheet" type="text/css"


href="assets/switcher/css/purple.css" title="purple" media="all" />

<link rel="apple-touch-icon-precomposed" sizes="144x144"


href="assets/images/favicon-icon/apple-touch-icon-144-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="114x114"


href="assets/images/favicon-icon/apple-touch-icon-114-precomposed.html">

<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/images/favicon-icon/apple-


touch-icon-72-precomposed.png">

<link rel="apple-touch-icon-precomposed" href="assets/images/favicon-icon/apple-touch-icon-57-


precomposed.png">

<link rel="shortcut icon" href="assets/images/favicon-icon/favicon.png">

<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet">

</head>

<body>

<!-- Start Switcher -->


<?php include('includes/colorswitcher.php');?>

<!-- /Switcher -->

<!--Header-->

<?php include('includes/header.php');?>

<!-- /Header -->

<!-- Banners -->

<section id="banner" class="banner-section">

<div class="container">

<div class="div_zindex">

<div class="row">

<div class="col-md-5 col-md-push-7">

<div class="banner_content">

<h1>Find the ideal car for you.</h1>

<p>We have more cars for you to choose. </p>

</div>

</div>

</div>

</div>

</section>

<!-- /Banners -->

<!-- Resent Cat-->

<section class="section-padding gray-bg">

<div class="container">

<div class="section-header text-center">


<h2>Find the Best <span>Car For You</span></h2>

<p>It is above all the uncompromising, performance-oriented aesthetic that unmistakeably


reveals its ambitions. Not elegant but extravagant. Not conventional but individual.</p>

</div>

<div class="row">

<!-- Nav tabs -->

<div class="recent-tab">

<ul class="nav nav-tabs" role="tablist">

<li role="presentation" class="active"><a href="#resentnewcar" role="tab" data-


toggle="tab">New Car</a></li>

</ul>

</div>

<!-- Recently Listed New Cars -->

<div class="tab-content">

<div role="tabpanel" class="tab-pane active" id="resentnewcar">

<?php $sql = "SELECT


tblvehicles.VehiclesTitle,tblbrands.BrandName,tblvehicles.PricePerDay,tblvehicles.FuelType,tblvehicl
es.ModelYear,tblvehicles.id,tblvehicles.SeatingCapacity,tblvehicles.VehiclesOverview,tblvehicles.Vim
age1 from tblvehicles join tblbrands on tblbrands.id=tblvehicles.VehiclesBrand";

$query = $dbh -> prepare($sql);

$query->execute();

$results=$query->fetchAll(PDO::FETCH_OBJ);

$cnt=1;

if($query->rowCount() > 0)

foreach($results as $result)

{
?>

<div class="col-list-3">

<div class="recent-car-list">

<div class="car-info-box"> <a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?


>"><img src="admin/img/vehicleimages/<?php echo htmlentities($result->Vimage1);?>" class="img-
responsive" alt="image"></a>

<ul>

<li><i class="fa fa-car" aria-hidden="true"></i><?php echo htmlentities($result->FuelType);?></li>

<li><i class="fa fa-calendar" aria-hidden="true"></i><?php echo htmlentities($result->ModelYear);?


> Model</li>

<li><i class="fa fa-user" aria-hidden="true"></i><?php echo htmlentities($result->SeatingCapacity);?


> seats</li>

</ul>

</div>

<div class="car-title-m">

<h6><a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?>"><?php echo


htmlentities($result->BrandName);?> , <?php echo htmlentities($result->VehiclesTitle);?></a></h6>

<span class="price">$<?php echo htmlentities($result->PricePerDay);?> /Day</span>

</div>

<div class="inventory_info_m">

<p><?php echo substr($result->VehiclesOverview,0,70);?></p>

</div>

</div>

</div>

<?php }}?>

</div>

</div>
</div>

</section>

<!-- /Resent Cat -->

<!-- Fun Facts-->

<section class="fun-facts-section">

<div class="container div_zindex">

<div class="row">

<div class="col-lg-3 col-xs-6 col-sm-3">

<div class="fun-facts-m">

<div class="cell">

<h2><i class="fa fa-calendar" aria-hidden="true"></i>40+</h2>

<p>Years In Business</p>

</div>

</div>

</div>

<div class="col-lg-3 col-xs-6 col-sm-3">

<div class="fun-facts-m">

<div class="cell">

<h2><i class="fa fa-car" aria-hidden="true"></i>1200+</h2>

<p>New Cars For Sale</p>

</div>

</div>

</div>

<div class="col-lg-3 col-xs-6 col-sm-3">

<div class="fun-facts-m">

<div class="cell">
<h2><i class="fa fa-car" aria-hidden="true"></i>1000+</h2>

<p>Used Cars For Sale</p>

</div>

</div>

</div>

<div class="col-lg-3 col-xs-6 col-sm-3">

<div class="fun-facts-m">

<div class="cell">

<h2><i class="fa fa-user-circle-o" aria-hidden="true"></i>600+</h2>

<p>Satisfied Customers</p>

</div>

</div>

</div>

</div>

</div>

<!-- Dark Overlay-->

<div class="dark-overlay"></div>

</section>

<!-- /Fun Facts-->

<!--Testimonial -->

<section class="section-padding testimonial-section parallex-bg">

<div class="container div_zindex">

<div class="section-header white-text text-center">

<h2>Our Satisfied <span>Customers</span></h2>

</div>
<div class="row">

<div id="testimonial-slider">

<?php

$tid=1;

$sql = "SELECT tbltestimonial.Testimonial,tblusers.FullName from tbltestimonial join tblusers on


tbltestimonial.UserEmail=tblusers.EmailId where tbltestimonial.status=:tid";

$query = $dbh -> prepare($sql);

$query->bindParam(':tid',$tid, PDO::PARAM_STR);

$query->execute();

$results=$query->fetchAll(PDO::FETCH_OBJ);

$cnt=1;

if($query->rowCount() > 0)

foreach($results as $result)

{ ?>

<div class="testimonial-m">

<div class="testimonial-img"> <img src="assets/images/cat-profile.png" alt="" /> </div>

<div class="testimonial-content">

<div class="testimonial-heading">

<h5><?php echo htmlentities($result->FullName);?></h5>

<p><?php echo htmlentities($result->Testimonial);?></p>

</div>

</div>

</div>

<?php }} ?>

</div>

</div>

</div>
<!-- Dark Overlay-->

<div class="dark-overlay"></div>

</section>

<!-- /Testimonial-->

<!--Footer -->

<?php include('includes/footer.php');?>

<!-- /Footer-->

<!--Back to top-->

<div id="back-top" class="back-top"> <a href="#top"><i class="fa fa-angle-up" aria-


hidden="true"></i> </a> </div>

<!--/Back to top-->

<!--Login-Form -->

<?php include('includes/login.php');?>

<!--/Login-Form -->

<!--Register-Form -->

<?php include('includes/registration.php');?>

<!--/Register-Form -->

<!--Forgot-password-Form -->

<?php include('includes/forgotpassword.php');?>

<!--/Forgot-password-Form -->

<!-- Scripts -->

<script src="assets/js/jquery.min.js"></script>

<script src="assets/js/bootstrap.min.js"></script>

<script src="assets/js/interface.js"></script>

<!--Switcher-->

<script src="assets/switcher/js/switcher.js"></script>
<!--bootstrap-slider-JS-->

<script src="assets/js/bootstrap-slider.min.js"></script>

<!--Slider-JS-->

<script src="assets/js/slick.min.js"></script>

<script src="assets/js/owl.carousel.min.js"></script>

</body>

<!-- Mirrored from themes.webmasterdriver.net/carforyou/demo/index.html by HTTrack Website


Copier/3.x [XR&CO'2014], Fri, 16 Jun 2017 07:22:11 GMT -->

</html>

Car listing codes

<?php

session_start();

include('includes/config.php');

error_reporting(0);

?>

<!DOCTYPE HTML>

<html lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width,initial-scale=1">

<meta name="keywords" content="">

<meta name="description" content="">

<title>Car Rental Portal | Car Listing</title>

<!--Bootstrap -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css" type="text/css">

<!--Custome Style -->

<link rel="stylesheet" href="assets/css/style.css" type="text/css">

<!--OWL Carousel slider-->

<link rel="stylesheet" href="assets/css/owl.carousel.css" type="text/css">

<link rel="stylesheet" href="assets/css/owl.transitions.css" type="text/css">

<!--slick-slider -->

<link href="assets/css/slick.css" rel="stylesheet">

<!--bootstrap-slider -->

<link href="assets/css/bootstrap-slider.min.css" rel="stylesheet">

<!--FontAwesome Font Style -->

<link href="assets/css/font-awesome.min.css" rel="stylesheet">

<!-- SWITCHER -->

<link rel="stylesheet" id="switcher-css" type="text/css"


href="assets/switcher/css/switcher.css" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/red.css"


title="red" media="all" data-default-color="true" />

<link rel="alternate stylesheet" type="text/css"


href="assets/switcher/css/orange.css" title="orange" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/blue.css"


title="blue" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/pink.css"


title="pink" media="all" />

<link rel="alternate stylesheet" type="text/css" href="assets/switcher/css/green.css"


title="green" media="all" />

<link rel="alternate stylesheet" type="text/css"


href="assets/switcher/css/purple.css" title="purple" media="all" />

<!-- Fav and touch icons -->


<link rel="apple-touch-icon-precomposed" sizes="144x144"
href="assets/images/favicon-icon/apple-touch-icon-144-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="114x114"


href="assets/images/favicon-icon/apple-touch-icon-114-precomposed.html">

<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/images/favicon-icon/apple-


touch-icon-72-precomposed.png">

<link rel="apple-touch-icon-precomposed" href="assets/images/favicon-icon/apple-touch-icon-57-


precomposed.png">

<link rel="shortcut icon" href="assets/images/favicon-icon/favicon.png">

<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet">

</head>

<body>

<!-- Start Switcher -->

<?php include('includes/colorswitcher.php');?>

<!-- /Switcher -->

<!--Header-->

<?php include('includes/header.php');?>

<!-- /Header -->

<!--Page Header-->

<section class="page-header listing_page">

<div class="container">

<div class="page-header_wrap">

<div class="page-heading">

<h1>Car Listing</h1>

</div>

<ul class="coustom-breadcrumb">
<li><a href="#">Home</a></li>

<li>Car Listing</li>

</ul>

</div>

</div>

<!-- Dark Overlay-->

<div class="dark-overlay"></div>

</section>

<!-- /Page Header-->

<!--Listing-->

<section class="listing-page">

<div class="container">

<div class="row">

<div class="col-md-9 col-md-push-3">

<div class="result-sorting-wrapper">

<div class="sorting-count">

<?php

//Query for Listing count

$sql = "SELECT id from tblvehicles";

$query = $dbh -> prepare($sql);

$query->bindParam(':vhid',$vhid, PDO::PARAM_STR);

$query->execute();

$results=$query->fetchAll(PDO::FETCH_OBJ);

$cnt=$query->rowCount();

?>

<p><span><?php echo htmlentities($cnt);?> Listings</span></p>


</div>

</div>

<?php $sql = "SELECT tblvehicles.*,tblbrands.BrandName,tblbrands.id as bid from tblvehicles join


tblbrands on tblbrands.id=tblvehicles.VehiclesBrand";

$query = $dbh -> prepare($sql);

$query->execute();

$results=$query->fetchAll(PDO::FETCH_OBJ);

$cnt=1;

if($query->rowCount() > 0)

foreach($results as $result)

{ ?>

<div class="product-listing-m gray-bg">

<div class="product-listing-img"><img src="admin/img/vehicleimages/<?php echo


htmlentities($result->Vimage1);?>" class="img-responsive" alt="Image" /> </a>

</div>

<div class="product-listing-content">

<h5><a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?>"><?php echo


htmlentities($result->BrandName);?> , <?php echo htmlentities($result->VehiclesTitle);?></a></h5>

<p class="list-price">$<?php echo htmlentities($result->PricePerDay);?> Per Day</p>

<ul>

<li><i class="fa fa-user" aria-hidden="true"></i><?php echo htmlentities($result-


>SeatingCapacity);?> seats</li>

<li><i class="fa fa-calendar" aria-hidden="true"></i><?php echo htmlentities($result-


>ModelYear);?> model</li>

<li><i class="fa fa-car" aria-hidden="true"></i><?php echo htmlentities($result->FuelType);?


></li>

</ul>
<a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?>" class="btn">View
Details <span class="angle_arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></span></a>

</div>

</div>

<?php }} ?>

</div>

<!--Side-Bar-->

<aside class="col-md-3 col-md-pull-9">

<div class="sidebar_widget">

<div class="widget_heading">

<h5><i class="fa fa-filter" aria-hidden="true"></i> Find Your Car </h5>

</div>

<div class="sidebar_filter">

<form action="search-carresult.php" method="post">

<div class="form-group select">

<select class="form-control" name="brand">

<option>Select Brand</option>

<?php $sql = "SELECT * from tblbrands ";

$query = $dbh -> prepare($sql);

$query->execute();

$results=$query->fetchAll(PDO::FETCH_OBJ);

$cnt=1;

if($query->rowCount() > 0)

foreach($results as $result)

{ ?>
<option value="<?php echo htmlentities($result->id);?>"><?php echo htmlentities($result-
>BrandName);?></option>

<?php }} ?>

</select>

</div>

<div class="form-group select">

<select class="form-control" name="fueltype">

<option>Select Fuel Type</option>

<option value="Petrol">Petrol</option>

<option value="Diesel">Diesel</option>

<option value="CNG">CNG</option>

</select>

</div>

<div class="form-group">

<button type="submit" class="btn btn-block"><i class="fa fa-search"


aria-hidden="true"></i> Search Car</button>

</div>

</form>

</div>

</div>

<div class="sidebar_widget">

<div class="widget_heading">

<h5><i class="fa fa-car" aria-hidden="true"></i> Recently Listed Cars</h5>

</div>

<div class="recent_addedcars">
<ul>

<?php $sql = "SELECT tblvehicles.*,tblbrands.BrandName,tblbrands.id as bid from tblvehicles join


tblbrands on tblbrands.id=tblvehicles.VehiclesBrand order by id desc limit 4";

$query = $dbh -> prepare($sql);

$query->execute();

$results=$query->fetchAll(PDO::FETCH_OBJ);

$cnt=1;

if($query->rowCount() > 0)

foreach($results as $result)

{ ?>

<li class="gray-bg">

<div class="recent_post_img"> <a href="vehical-details.php?vhid=<?php echo


htmlentities($result->id);?>"><img src="admin/img/vehicleimages/<?php echo htmlentities($result-
>Vimage1);?>" alt="image"></a> </div>

<div class="recent_post_title"> <a href="vehical-details.php?vhid=<?php echo


htmlentities($result->id);?>"><?php echo htmlentities($result->BrandName);?> , <?php echo
htmlentities($result->VehiclesTitle);?></a>

<p class="widget_price">$<?php echo htmlentities($result->PricePerDay);?> Per Day</p>

</div>

</li>

<?php }} ?>

</ul>

</div>

</div>

</aside>

<!--/Side-Bar-->
</div>

</div>

</section>

<!-- /Listing-->

<!--Footer -->

<?php include('includes/footer.php');?>

<!-- /Footer-->

<!--Back to top-->

<div id="back-top" class="back-top"> <a href="#top"><i class="fa fa-angle-up" aria-


hidden="true"></i> </a> </div>

<!--/Back to top-->

<!--Login-Form -->

<?php include('includes/login.php');?>

<!--/Login-Form -->

<!--Register-Form -->

<?php include('includes/registration.php');?>

<!--/Register-Form -->

<!--Forgot-password-Form -->

<?php include('includes/forgotpassword.php');?>

<!-- Scripts -->

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

<script src="assets/js/interface.js"></script>

<!--Switcher-->

<script src="assets/switcher/js/switcher.js"></script>

<!--bootstrap-slider-JS-->

<script src="assets/js/bootstrap-slider.min.js"></script>

<!--Slider-JS-->

<script src="assets/js/slick.min.js"></script>

<script src="assets/js/owl.carousel.min.js"></script>

</body>

</html>

Post cars

<?php

session_start();

error_reporting(0);

include('includes/config.php');

if(strlen($_SESSION['alogin'])==0)

header('location:index.php');

else{
if(isset($_POST['submit']))

$vehicletitle=$_POST['vehicletitle'];

$brand=$_POST['brandname'];

$vehicleoverview=$_POST['vehicalorcview'];

$priceperday=$_POST['priceperday'];

$fueltype=$_POST['fueltype'];

$modelyear=$_POST['modelyear'];

$seatingcapacity=$_POST['seatingcapacity'];

$vimage1=$_FILES["img1"]["name"];

$vimage2=$_FILES["img2"]["name"];

$vimage3=$_FILES["img3"]["name"];

$vimage4=$_FILES["img4"]["name"];

$vimage5=$_FILES["img5"]["name"];

$airconditioner=$_POST['airconditioner'];

$powerdoorlocks=$_POST['powerdoorlocks'];

$antilockbrakingsys=$_POST['antilockbrakingsys'];

$brakeassist=$_POST['brakeassist'];

$powersteering=$_POST['powersteering'];

$driverairbag=$_POST['driverairbag'];

$passengerairbag=$_POST['passengerairbag'];

$powerwindow=$_POST['powerwindow'];

$cdplayer=$_POST['cdplayer'];

$centrallocking=$_POST['centrallocking'];

$crashcensor=$_POST['crashcensor'];

$leatherseats=$_POST['leatherseats'];
move_uploaded_file($_FILES["img1"]["tmp_name"],"img/vehicleimages/".$_FILES["img1"]
["name"]);

move_uploaded_file($_FILES["img2"]["tmp_name"],"img/vehicleimages/".$_FILES["img2"]
["name"]);

move_uploaded_file($_FILES["img3"]["tmp_name"],"img/vehicleimages/".$_FILES["img3"]
["name"]);

move_uploaded_file($_FILES["img4"]["tmp_name"],"img/vehicleimages/".$_FILES["img4"]
["name"]);

move_uploaded_file($_FILES["img5"]["tmp_name"],"img/vehicleimages/".$_FILES["img5"]
["name"]);

$sql="INSERT INTO
tblvehicles(VehiclesTitle,VehiclesBrand,VehiclesOverview,PricePerDay,FuelType,ModelYear,SeatingC
apacity,Vimage1,Vimage2,Vimage3,Vimage4,Vimage5,AirConditioner,PowerDoorLocks,AntiLockBraki
ngSystem,BrakeAssist,PowerSteering,DriverAirbag,PassengerAirbag,PowerWindows,CDPlayer,Centra
lLocking,CrashSensor,LeatherSeats)
VALUES(:vehicletitle,:brand,:vehicleoverview,:priceperday,:fueltype,:modelyear,:seatingcapacity,:vi
mage1,:vimage2,:vimage3,:vimage4,:vimage5,:airconditioner,:powerdoorlocks,:antilockbrakingsys,:b
rakeassist,:powersteering,:driverairbag,:passengerairbag,:powerwindow,:cdplayer,:centrallocking,:cr
ashcensor,:leatherseats)";

$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(':priceperday',$priceperday,PDO::PARAM_STR);

$query->bindParam(':fueltype',$fueltype,PDO::PARAM_STR);

$query->bindParam(':modelyear',$modelyear,PDO::PARAM_STR);

$query->bindParam(':seatingcapacity',$seatingcapacity,PDO::PARAM_STR);

$query->bindParam(':vimage1',$vimage1,PDO::PARAM_STR);

$query->bindParam(':vimage2',$vimage2,PDO::PARAM_STR);

$query->bindParam(':vimage3',$vimage3,PDO::PARAM_STR);

$query->bindParam(':vimage4',$vimage4,PDO::PARAM_STR);

$query->bindParam(':vimage5',$vimage5,PDO::PARAM_STR);
$query->bindParam(':airconditioner',$airconditioner,PDO::PARAM_STR);

$query->bindParam(':powerdoorlocks',$powerdoorlocks,PDO::PARAM_STR);

$query->bindParam(':antilockbrakingsys',$antilockbrakingsys,PDO::PARAM_STR);

$query->bindParam(':brakeassist',$brakeassist,PDO::PARAM_STR);

$query->bindParam(':powersteering',$powersteering,PDO::PARAM_STR);

$query->bindParam(':driverairbag',$driverairbag,PDO::PARAM_STR);

$query->bindParam(':passengerairbag',$passengerairbag,PDO::PARAM_STR);

$query->bindParam(':powerwindow',$powerwindow,PDO::PARAM_STR);

$query->bindParam(':cdplayer',$cdplayer,PDO::PARAM_STR);

$query->bindParam(':centrallocking',$centrallocking,PDO::PARAM_STR);

$query->bindParam(':crashcensor',$crashcensor,PDO::PARAM_STR);

$query->bindParam(':leatherseats',$leatherseats,PDO::PARAM_STR);

$query->execute();

$lastInsertId = $dbh->lastInsertId();

if($lastInsertId)

$msg="Vehicle posted successfully";

else

$error="Something went wrong. Please try again";

?>
<!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>Car Rental Portal | Admin Post Vehicle</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">Post A Vehicle</h2>

<div class="row">

<div class="col-md-12">

<div class="panel panel-default">

<div class="panel-
heading">Basic Info</div>

<?php if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo


htmlentities($error); ?> </div><?php }

else if($msg){?><div
class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?>

<div class="panel-body">

<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" 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=""> Select </option>


<?php $ret="select id,BrandName from tblbrands";

$query= $dbh -> prepare($ret);

//$query->bindParam(':id',$id, PDO::PARAM_STR);

$query-> execute();

$results = $query -> fetchAll(PDO::FETCH_OBJ);

if($query -> rowCount() > 0)

foreach($results as $result)

?>

<option value="<?php echo htmlentities($result->id);?>"><?php echo htmlentities($result-


>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></textarea>

</div>

</div>

<div class="form-group">
<label class="col-sm-2 control-label">Price Per Day(in USD)<span
style="color:red">*</span></label>

<div class="col-sm-4">

<input type="text" name="priceperday" class="form-control" required>

</div>

<label class="col-sm-2 control-label">Select Fuel Type<span style="color:red">*</span></label>

<div class="col-sm-4">

<select class="selectpicker" name="fueltype" required>

<option value=""> Select </option>

<option value="Petrol">Petrol</option>

<option value="Diesel">Diesel</option>

<option value="CNG">CNG</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" required>

</div>

<label class="col-sm-2 control-label">Seating Capacity<span style="color:red">*</span></label>

<div class="col-sm-4">

<input type="text" name="seatingcapacity" class="form-control" required>

</div>

</div>
<div class="hr-dashed"></div>

<div class="form-group">

<div class="col-sm-12">

<h4><b>Upload Images</b></h4>

</div>

</div>

<div class="form-group">

<div class="col-sm-4">

Image 1 <span style="color:red">*</span><input type="file" name="img1" required>

</div>

<div class="col-sm-4">

Image 2<span style="color:red">*</span><input type="file" name="img2" required>

</div>

<div class="col-sm-4">

Image 3<span style="color:red">*</span><input type="file" name="img3" required>

</div>

</div>

<div class="form-group">

<div class="col-sm-4">

Image 4<span style="color:red">*</span><input type="file" name="img4" required>

</div>
<div class="col-sm-4">

Image 5<input type="file" name="img5">

</div>

</div>

<div class="hr-dashed"></div>

</div>

</div>

</div>

</div>

<div class="row">

<div class="col-md-12">

<div class="panel panel-default">

<div class="panel-heading">Accessories</div>

<div class="panel-body">

<div class="form-group">

<div class="col-sm-3">

<div class="checkbox checkbox-inline">

<input type="checkbox" id="airconditioner" name="airconditioner" value="1">

<label for="airconditioner"> Air Conditioner </label>

</div>

</div>

<div class="col-sm-3">
<div class="checkbox checkbox-inline">

<input type="checkbox" id="powerdoorlocks" name="powerdoorlocks" value="1">

<label for="powerdoorlocks"> Power Door Locks </label>

</div></div>

<div class="col-sm-3">

<div class="checkbox checkbox-inline">

<input type="checkbox" id="antilockbrakingsys" name="antilockbrakingsys" value="1">

<label for="antilockbrakingsys"> AntiLock Braking System </label>

</div></div>

<div class="checkbox checkbox-inline">

<input type="checkbox" id="brakeassist" name="brakeassist" value="1">

<label for="brakeassist"> Brake Assist </label>

</div>

</div>

<div class="form-group">

<div class="col-sm-3">

<div class="checkbox checkbox-inline">

<input type="checkbox" id="powersteering" name="powersteering" value="1">

<input type="checkbox" id="powersteering" name="powersteering" value="1">

<label for="inlineCheckbox5"> Power Steering </label>

</div>

</div>

<div class="col-sm-3">

<div class="checkbox checkbox-inline">


<input type="checkbox" id="driverairbag" name="driverairbag" value="1">

<label for="driverairbag">Driver Airbag</label>

</div>

</div>

<div class="col-sm-3">

<div class="checkbox checkbox-inline">

<input type="checkbox" id="passengerairbag" name="passengerairbag" value="1">

<label for="passengerairbag"> Passenger Airbag </label>

</div></div>

<div class="checkbox checkbox-inline">

<input type="checkbox" id="powerwindow" name="powerwindow" value="1">

<label for="powerwindow"> Power Windows </label>

</div>

</div>

<div class="form-group">

<div class="col-sm-3">

<div class="checkbox checkbox-inline">

<input type="checkbox" id="cdplayer" name="cdplayer" value="1">

<label for="cdplayer"> CD Player </label>

</div>

</div>

<div class="col-sm-3">

<div class="checkbox h checkbox-inline">

<input type="checkbox" id="centrallocking" name="centrallocking" value="1">

<label for="centrallocking">Central Locking</label>


</div></div>

<div class="col-sm-3">

<div class="checkbox checkbox-inline">

<input type="checkbox" id="crashcensor" name="crashcensor" value="1">

<label for="crashcensor"> Crash Sensor </label>

</div></div>

<div class="col-sm-3">

<div class="checkbox checkbox-inline">

<input type="checkbox" id="leatherseats" name="leatherseats" value="1">

<label for="leatherseats"> Leather Seats </label>

</div>

</div>

</div>

<div
class="form-group">

<div
class="col-sm-8 col-sm-offset-2">

<button class="btn btn-default" type="reset">Cancel</button>

<button class="btn btn-primary" name="submit" type="submit">Save changes</button>

</div>

</div>
</form>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</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 } ?>

Edit brand

<?php

session_start();

error_reporting(0);

include('includes/config.php');

if(strlen($_SESSION['alogin'])==0)

header('location:index.php');

else{

// Code for change password

if(isset($_POST['submit']))

$brand=$_POST['brand'];

$id=$_GET['id'];

$sql="update tblbrands set BrandName=:brand where id=:id";

$query = $dbh->prepare($sql);

$query->bindParam(':brand',$brand,PDO::PARAM_STR);

$query->bindParam(':id',$id,PDO::PARAM_STR);

$query->execute();
$lastInsertId = $dbh->lastInsertId();

$msg="Brand updted 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>Car Rental Portal | Admin Create Brand</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">Create Brand</h2>

<div class="row">

<div class="col-md-10">

<div class="panel panel-default">

<div class="panel-
heading">Form fields</div>

<div class="panel-body">

<form
method="post" name="chngpwd" class="form-horizontal" onSubmit="return valid();">

<?php if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo


htmlentities($error); ?> </div><?php }
else if($msg){?><div
class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?>

<?php

$id=$_GET['id'];

$ret="select * from tblbrands where id=:id";

$query= $dbh -> prepare($ret);

$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)

?>

<div
class="form-group">

<label class="col-sm-4 control-label">Brand Name</label>

<div
class="col-sm-8">

<input type="text" class="form-control" value="<?php echo htmlentities($result-


>BrandName);?>" name="brand" id="brand" required>

</div>

</div>

<div
class="hr-dashed"></div>
<?php }} ?>

<div
class="form-group">

<div
class="col-sm-8 col-sm-offset-4">

<button class="btn btn-primary" name="submit" type="submit">Submit</button>

</div>

</div>

</form>

</div>

</div>

</div>

</div>

</div>

</div>
</div>

</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 } ?>

Create Brand

<?php

session_start();

error_reporting(0);

include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)

header('location:index.php');

else{

// Code for change password

if(isset($_POST['submit']))

$brand=$_POST['brand'];

$id=$_GET['id'];

$sql="update tblbrands set BrandName=:brand where id=:id";

$query = $dbh->prepare($sql);

$query->bindParam(':brand',$brand,PDO::PARAM_STR);

$query->bindParam(':id',$id,PDO::PARAM_STR);

$query->execute();

$lastInsertId = $dbh->lastInsertId();

$msg="Brand updted 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>Car Rental Portal | Admin Create Brand</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">Create Brand</h2>

<div class="row">

<div class="col-md-10">

<div class="panel panel-default">

<div class="panel-
heading">Form fields</div>

<div class="panel-body">

<form
method="post" name="chngpwd" class="form-horizontal" onSubmit="return valid();">

<?php if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo


htmlentities($error); ?> </div><?php }

else if($msg){?><div
class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?>

<?php

$id=$_GET['id'];

$ret="select * from tblbrands where id=:id";

$query= $dbh -> prepare($ret);

$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)

?>

<div
class="form-group">

<label class="col-sm-4 control-label">Brand Name</label>

<div
class="col-sm-8">

<input type="text" class="form-control" value="<?php echo htmlentities($result-


>BrandName);?>" name="brand" id="brand" required>

</div>

</div>

<div
class="hr-dashed"></div>

<?php }} ?>

<div
class="form-group">

<div
class="col-sm-8 col-sm-offset-4">

<button class="btn btn-primary" name="submit" type="submit">Submit</button>

</div>

</div>
</form>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</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 } ?>

Database Design:

You might also like