Property Renting portal PHP Web Application Project using MySQL is developed to provide a common web based interface to property owners and prospective tenants. The owners can upload the details of their properties for renting out. The tenants can search the properties of their interest and request for renting. This Web Application is a very basic implementation.  It can be further extended by allowing the users to update the information.

Property Owner Dashboard

A property owner can register and then login by providing credentials in the home page. The property owner dashboard displays two options. First option is to add a new property for renting. This web form asks for exhaustive parameters about the property. From the provided drop down owner can select the category of property like flat, bungalow,  shop, cabin etc. All the properties once added have status ‘A’ for available in property_tbl .

The second option in the property owner dashboard is to rent the property to one of the tenants who have requested after the search process. A owner can rent out the property to a certain tenant by clicking “RentOut” Button. Status of rented property is updated in the property_tbl with ‘R’ for Rented

Tenant Dashboard

A tenant logs on with her credential.  She is presented with dashboard to search for property of her choice and messages about properties rented to her. The search page ask for parameters like city, property type, number of rooms, furnished or not, area type and range of rent amount. Once a tenant fills these all the parameters, properties matching these filters are listed out each with a ‘Request for rent’ button.

When a tenant clicks this button a request is sent to owner. Owner dashboard displays all the requests and rents the property to one of the requesting members. When a tenant logs in and if her request for rent is accepted, a message will be displayed to her.

Activities included in the Property Renting Portal- PHP Web Application Project

  • Member Registration
  • Property Addition
  • Property search
  • Rent request
  • Tenant Rent-out
  • Message displaying to rent

Platform Requirements

  • PHP
  • MySQL
  • HTML
  • AJAX
  • Bootstrap CSS styles

Interface and code

Home.php

Property renting portal- PHP web application project home page

home.php
 
<HTML>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<BODY>
<div class="container">
<div style="width: 1100px;  border-width: 1px; height:150px; text-align:center; background-color:rgba(255, 99, 71, 0.6)"><h2 style="padding-top:50px">Property Renting Portal</h2></div>
<div style="width: 1100px;  border-width: 1px; height:30px; text-align:center; background-color:rgb(255, 99, 71)"></div>
<div>
      <div class="mh-100" style="width: 1100px; height:100%; border-style: groove; border-width: 1px;">
      <div class="mh-100" style="width: 400px; padding-top:30px; border-width: 1px; margin-left: auto; margin-top: 30px;  margin-right: auto; height:400px; text-align:center; background-color:rgba(255, 99, 71, 0.3)">
      
      <form action="home.php" Method="POST">
      <b>Login as </b> <input type="radio" name="user" value="Tenant" checked > Tenant </input><input type="radio" name="user" value="Owner">Property Owner</input><br><br><br>
      <div class="form-group">
      
                  <label for="exampleInputName">User Name</label>
                  <input type="string" class="form-control" id="username" name="username" aria-describedby="emailHelp" placeholder="Enter Your Name">
                  
              </div>
              <div class="form-group">
                  <label for="exampleInputPassword1">Password</label>
                  <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" name="password">
                  
              </div>
              <button type="submit" name="submit" class="btn btn-primary" style="border-color:rgb(255, 99, 71);background-color:rgb(255, 99, 71)">Submit</button>
              <a href="MemberReg.php"><input type="button" class="btn btn-primary" style="border-color:rgb(255, 99, 71);background-color:rgb(255, 99, 71)" value="Register as new user"></a>
              
              <?php
                  if (isset($_POST['submit']))
                  {
                  $con=mysqli_connect("localhost","root","","renting_db");
                  $uType=$_POST['user'];
                  $uname=$_POST['username'];
                  $pwd=$_POST['password'];
                  $qry="Select MemberID, password from member_tbl where MemberType='$uType' and MemberName='$uname'";
                  //echo $qry;
                  $res=mysqli_query($con,$qry);
                  while ($row=mysqli_fetch_array($res))
                  {
                        if ($pwd==$row['password']) 
                        {
                                    echo "<script> alert('Login Successful');</script>";
                                    session_start();
                                    $_SESSION['memID']=$row['MemberID'];
                                    $_SESSION['Uname']=$uname;
                                    $_SESSION['Utype']=$uType;
                                    header('refresh:0;url=Dashboard.php');
                        }
                        else
                        {
                              echo '<script> alert("Incorrect UserName/User Type/Password");</script>';
                              header('refresh:0;url=Home.php');
                        }
                  }
                  }
                  ?>
       </div>
      </form>
      </div>
      </div>
</div>
<BODY>

dashboard.php

Property Owner dashboard

Tenant Dashboard

dashboard.php
 
<HTML>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("#newprop").click(function(){
    $("#contents").load("Property.php");
  });
  $("#rentprop").click(function(){
    $("#contents").load("OwnerList.php");
  });
  $("#searchprop").click(function(){
    $("#contents").load("Search.php");
  });
   
});
</script>
</head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<BODY>
<div class="container">
<div style="width: 1100px;  border-width: 1px; height:150px; text-align:center; background-color:rgba(255, 99, 71, 0.6)"><h2 style="padding-top:50px">Property Renting Portal</h2></div>
<div style="width: 1100px;  border-width: 1px; height:30px; text-align:right; background-color:rgb(255, 99, 71); padding-right:30px;"><?php
            session_start();
            $utype=$_SESSION['Utype'];
            $uname=$_SESSION['Uname'];
            $memID=$_SESSION['memID'];
            echo '<a href="logout.php" style="color:white;">Log out '.$uname.'</a>';
            ?></div>
<div>
      <div class="mh-100" style="width: 200px; height:100%; border-style: groove; border-width: 1px; float:left">
            <nav class="navbar navbar-light bg-light">
            <?php
            if ($utype=='Owner')
            {
                  echo '<a class="navbar-brand" id="newprop" href="#" >Add Property</a>';
                  echo '<a class="navbar-brand" id="rentprop" href="#">Rentout Property</a>';
            }
            else
            {      
                  echo '<a class="navbar-brand" id="searchprop" href="#">Search Property</a>';
                              
            }
            
            
            ?>
            </nav>
      </div>
      <div>
      
      </div>
      <div class="mh-100" id="contents" style="width: 900px;height:100%; border-style: groove; border-width: 1px;  float:left; padding-left:30px; padding-top:30px;"><?php
      if (isset($_SESSION['datahtm']))
            {
                  $tt=$_SESSION['datahtm'];
                  echo $tt;
                  unset($_SESSION['datahtm']);
            }
            else
            {
                  $con=mysqli_connect("localhost","root","","renting_db");
                  $qry="select * from property_tbl where propertyID in (select propertyID from rent_tbl where memberID=$memID and rentdate<>'0000-00-00')";
                  $res=mysqli_query($con,$qry);
                  while ($row=mysqli_fetch_array($res))
                  {
                        echo "Congratulations!!!<br>Your rent request for property ID:".$row['PropertyID']."  ".$row['PropertyType']. " in ". $row['City']. " has been accepted";
                  }
            }
      ?></div>
      </div>
</div>
<BODY>

MemberReg.php

Member Registration form

MemberReg.php
 
<HTML>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("#newprop").click(function(){
    $("#contents").load("Property.php");
  });
  $("#rentprop").click(function(){
    $("#contents").load("OwnerList.php");
  });
  $("#searchprop").click(function(){
    $("#contents").load("Search.php");
  });
   
});
</script>
</head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<BODY>
<div class="container">
<div style="width: 1100px;  border-width: 1px; height:150px; text-align:center; background-color:rgba(255, 99, 71, 0.6)"><h2 style="padding-top:50px">Property Renting Portal</h2></div>
<div style="width: 1100px;  border-width: 1px; height:30px; text-align:right; background-color:rgb(255, 99, 71); padding-right:30px;"><?php
            session_start();
            $utype=$_SESSION['Utype'];
            $uname=$_SESSION['Uname'];
            $memID=$_SESSION['memID'];
            echo '<a href="logout.php" style="color:white;">Log out '.$uname.'</a>';
            ?></div>
<div>
      <div class="mh-100" style="width: 200px; height:100%; border-style: groove; border-width: 1px; float:left">
            <nav class="navbar navbar-light bg-light">
            <?php
            if ($utype=='Owner')
            {
                  echo '<a class="navbar-brand" id="newprop" href="#" >Add Property</a>';
                  echo '<a class="navbar-brand" id="rentprop" href="#">Rentout Property</a>';
            }
            else
            {      
                  echo '<a class="navbar-brand" id="searchprop" href="#">Search Property</a>';
                              
            }
            
            
            ?>
            </nav>
      </div>
      <div>
      
      </div>
      <div class="mh-100" id="contents" style="width: 900px;height:100%; border-style: groove; border-width: 1px;  float:left; padding-left:30px; padding-top:30px;"><?php
      if (isset($_SESSION['datahtm']))
            {
                  $tt=$_SESSION['datahtm'];
                  echo $tt;
                  unset($_SESSION['datahtm']);
            }
            else
            {
                  $con=mysqli_connect("localhost","root","","renting_db");
                  $qry="select * from property_tbl where propertyID in (select propertyID from rent_tbl where memberID=$memID and rentdate<>'0000-00-00')";
                  $res=mysqli_query($con,$qry);
                  while ($row=mysqli_fetch_array($res))
                  {
                        echo "Congratulations!!!<br>Your rent request for property ID:".$row['PropertyID']."  ".$row['PropertyType']. " in ". $row['City']. " has been accepted";
                  }
            }
      ?></div>
      </div>
</div>
<BODY>

registration successful message

Search.php

Search Property

search.php
 
<HTML>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<BODY>
<form method="post" action="display.php" >
<div class="container">
 <div class="row">
    <div class="col">
     <label for="exampleFormControlSelect1">Property Type</label>
    <select class="form-control" name="pType" id="exampleFormControlSelect1">
      <option>Flat</option>
      <option>Bunglow</option>
      <option>Floor</option>
      <option>Shop</option>
      <option>Cabin</option>
    </select>
      City<input type="Name" class="form-control" id="exampleInputName" name="pCity" placeholder="Enter the City">
      
      <label for="exampleFormControlName">Room Count</label>
            <input type="Name" class="form-control" id="exampleInputName" name="pRooms" placeholder="Enter the count of rooms">
      <label for="exampleFormControlName">Rent between</label>
            <input type="Name" class="form-control" id="exampleInputName" name="pRentfrom" placeholder="Minimum Rent Amout">
      
      </div>
      
    <div class="col">
      <br><br>
      <legend class="col-form-label col-l-2 pt-0">Property Location Area</legend>
      <div class="form-check form-check-inline" >
            <input class="form-check-input" type="radio" name="AreaType" id="exampleRadios2" value="Urban">Urban
            <input class="form-check-input" type="radio" name="AreaType" id="exampleRadios2" value="Rural">Rural
      </div>
      <legend class="col-form-label col-l-2 pt-0">Locality Type</legend>
      <div class="form-check form-check-inline">
            <input class="form-check-input" type="radio" name="LocalityType" id="exampleRadios2" value="Society">Society
            <input class="form-check-input" type="radio" name="LocalityType" id="exampleRadios2" value="Locality">Locality
      </div>
            <legend class="col-form-label col-l-2 pt-0">Property Furnished</legend>
      <div class="form-check form-check-inline">
            <input class="form-check-input" type="radio" name="pFur" id="exampleRadios2" value="F">Furnished
            <input class="form-check-input" type="radio" name="pFur" id="exampleRadios2" value="S">Semi-Furnished
            <input class="form-check-input" type="radio" name="pFur" id="exampleRadios2" value="U">UnFurnished
      </div><br><br>
      <input type="Name" class="form-control" id="exampleInputName" name="pRentTo" placeholder="Maximum Rent Amout">
    </div>
    </div>
      <br><button class="btn btn-success"  name="submit" id="exampleSubmit" value="submit" style="border-color:rgb(255, 99, 71);background-color:rgb(255, 99, 71)">Show Properties</button>
 </div>
</form>      
</BODY>
</HTML>

display.php

The results of this script are saved in a session variable that is sent back to the dashboard.php. If the user has selected the search option the results of this script are displayed as search properties in dashboard.

 

Search results

display.php
 
<?php
echo '<script type="text/javascript">location.href = "dashboard.php#contents";</script>';
session_start();
if (isset($_POST['submit']))
{
      
$con=mysqli_connect("localhost","root","","renting_db");
$pType=$_POST['pType'];
$pCity=$_POST['pCity'];
$pRooms=$_POST['pRooms'];
$pRentFAmt=$_POST['pRentfrom'];
$pRentTAmt=$_POST['pRentTo'];
$AreaType=$_POST['AreaType'];
$LocalityType=$_POST['LocalityType'];
$pFur=$_POST['pFur'];
$qry="Select * from Property_tbl  where PropertyType='$pType' and AreaType='$AreaType' and City='$pCity' and SocietyLocality='$LocalityType'  and Rooms= $pRooms and RentAmt between $pRentFAmt and $pRentTAmt and Status='A'";
//echo $qry;
$res=mysqli_query($con,$qry);
$htm=<<<_lbl
<table class="table">
  <thead class="thead-light">
    <tr>
      <th scope="col">Property ID</th>
      <th scope="col">Floor</th>
      <th scope="col">Rooms</th>
      <th scope="col">Bathrooms</th>
        <th scope="col">Toilets</th>
        <th scope="col">User Action</th>
    </tr>
  </thead>
  <tbody>
_lbl;
foreach ($res as $prop)
      {
            $htm=$htm. "<tr>";
            $htm=$htm. "<td>".$prop['PropertyID']. "</td>";
            $key=$prop['PropertyID'];
            $htm=$htm. "<td>".$prop['Floor']. "</td>";
            $htm=$htm. "<td>".$prop['Rooms']. "</td>";
            $htm=$htm. "<td>".$prop['Bathrooms']. "</td>";
            $htm=$htm. "<td>".$prop['Toilets']. "</td>";
            $htm=$htm. '<td><a class="btn btn-primary" href="rentReq.php?pid='.$key.'" role="button" style="border-color:rgb(255, 99, 71);background-color:rgb(255, 99, 71)">Request for Rent</a></td>';
        $htm=$htm. "</tr>";
      }
      $_SESSION['datahtm']=$htm;
}
?>

rentreq.php

This is script is executed to send rent request to owner by the tenant. The rent_tbl gets data from this script.

rent request

rentreq.php
 
<?php
$con=mysqli_connect("localhost","root","","renting_db");
session_start();
$memid=$_SESSION['memID'];
$pid=$_GET['pid'];
$qry="insert into rent_tbl  (memberid, PropertyID, RequestDate) values($memid,$pid,'".date("Y/m/d")."' )";
//echo $qry;
$res=mysqli_query($con,$qry);
if (mysqli_affected_rows($con)>0)
{
            echo "<script>alert('Request sent to the property owner');</script>";
            header('refresh:0;url=dashboard.php');
}
      else
      {            
            echo"<script>alert('Property not available on rent');</script>";
            header('refresh:0;url=dashboard.php');
      }
?>

ownerList.php

Owner rent Request

ownerList.php
 
<HTML>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<BODY>
<div class="container">
 <div class="row">
    <div class="col">
<?php
session_start();
$oid=$_SESSION['memID'];
$con=mysqli_connect("localhost","root","","renting_db");
$qry="Select R.propertyid,city,M.MemberName,M.MemberID,R.RequestDate from rent_tbl R, Property_tbl P, member_tbl M, Owner_Tbl O where R.propertyid= O.propertyid and O.propertyid =P.propertyid and O.MemberID=$oid and R.MemberID=M.MemberID and status='A'";
$res=mysqli_query($con,$qry);
$htm=<<<_lbl
<table class="table">
  <thead class="thead-light">
    <tr>
      <th scope="col">Property ID</th>
      <th scope="col">City</th>
      <th scope="col">Requested by</th>
      <th scope="col">Request Date</th>
        <th scope="col">User Action</th>
    </tr>
  </thead>
  <tbody>
_lbl;
echo $htm;
foreach ($res as $prop)
      {
            echo "<tr>";
            echo "<td>".$prop['propertyid']. "</td>";
            $key=$prop['propertyid'];
            echo "<td>".$prop['city']. "</td>";
            $mid=$prop['MemberID'];
            echo "<td>".$prop['MemberName']. "</td>";
            echo "<td>".$prop['RequestDate']. "</td>";
                        echo '<td><a class="btn btn-primary" href="rentOut.php?pid='.$key.'&memid='.$mid.'" role="button" style="border-color:rgb(255, 99, 71);background-color:rgb(255, 99, 71)" >Rent Out</a></td>';
        echo "</tr>";
      }
?></div>
</div>
</div>
</form>      
</BODY>
</HTML>

rentout.php

Rent Out message

rentout.php
 
<?php
$con=mysqli_connect("localhost","root","","renting_db");
$pid=$_GET['pid'];
$mid=$_GET['memid'];
$qry="update rent_tbl set RentDate='".date("Y/m/d")."' where MemberID=$mid and PropertyID=$pid";
echo $qry;
$res=mysqli_query($con,$qry);
if (mysqli_affected_rows($con)>0)
{
            $qry="update property_tbl set status='R' where PropertyID=$pid";
            //echo $qry;
            $res=mysqli_query($con,$qry);
            echo "<script>alert('Property Rented Successfully');</script>";
            header('refresh:0;url=dashboard.php');
}
      else
      {            
            echo"<script>alert('Could not complete process');</script>";
            header('refresh:0;url=dashboard.php');
      }
?>

logout.php

This script is executed at anytime a user clicks the logout option from upper right side of dashboard. Session variables are unset and session is destroyed The home page is displayed back to the user.

logout.php
 
<?php
session_start();
session_unset();
session_destroy();
header('refresh:0;url=Home.php');
?>

Closing Words..

Property Renting Portal- PHP Web Application Project is a simple web application to clarify the concepts of database programming in PHP. It is aimed for the beginners who are looking for complete PHP Web Application Projects for concept clarity and  flow of web based applications.