Friday, 1 April 2016

ASCII TABLE, DECIMAL VALUES WITH THEIR ASCII CODES


ASCII TABLE, DECIMAL VALUES WITH THEIR ASCII CODES


ASCII Table

Here are some tricky things before going to the ascii code part:


Dec  = Decimal Value
Char = Character

'5' has the int value 53
if we write '5'-'0' it evaluates to 53-48, or the int 5
if we write char c = 'B'+32; then c stores 'b'


Decimal values with their ascii codes


Dec  Char                           Dec  Char     Dec  Char     Dec  Char
---------                           ---------     ---------     ----------
  0  NUL (null)                      32  SPACE     64  @         96  `
  1  SOH (start of heading)          33  !         65  A         97  a
  2  STX (start of text)             34  "         66  B         98  b
  3  ETX (end of text)               35  #         67  C         99  c
  4  EOT (end of transmission)       36  $         68  D        100  d
  5  ENQ (enquiry)                   37  %         69  E        101  e
  6  ACK (acknowledge)               38  &         70  F        102  f
  7  BEL (bell)                      39  '         71  G        103  g
  8  BS  (backspace)                 40  (         72  H        104  h
  9  TAB (horizontal tab)            41  )         73  I        105  i
 10  LF  (NL line feed, new line)    42  *         74  J        106  j
 11  VT  (vertical tab)              43  +         75  K        107  k
 12  FF  (NP form feed, new page)    44  ,         76  L        108  l
 13  CR  (carriage return)           45  -         77  M        109  m
 14  SO  (shift out)                 46  .         78  N        110  n
 15  SI  (shift in)                  47  /         79  O        111  o
 16  DLE (data link escape)          48  0         80  P        112  p
 17  DC1 (device control 1)          49  1         81  Q        113  q
 18  DC2 (device control 2)          50  2         82  R        114  r
 19  DC3 (device control 3)          51  3         83  S        115  s
 20  DC4 (device control 4)          52  4         84  T        116  t
 21  NAK (negative acknowledge)      53  5         85  U        117  u
 22  SYN (synchronous idle)          54  6         86  V        118  v
 23  ETB (end of trans. block)       55  7         87  W        119  w
 24  CAN (cancel)                    56  8         88  X        120  x
 25  EM  (end of medium)             57  9         89  Y        121  y
 26  SUB (substitute)                58  :         90  Z        122  z
 27  ESC (escape)                    59  ;         91  [        123  {
 28  FS  (file separator)            60  <         92  \        124  |
 29  GS  (group separator)           61  =         93  ]        125  }
 30  RS  (record separator)          62  >         94  ^        126  ~
 31  US  (unit separator)            63  ?         95  _        127  DEL


Javascript: Text Input Allow Only Numeric Values

JavaScript Text Input Allow Only Numeric Value



While working with the form in HTML, we need some fields which allow us only to enter numeric values, so that the user can not by mistake insert character type values, for example phone no, pin code etc. To avoid insertion of character type values we can write a function such that it allow us to enter only numerical data.

HTML CODE

<input type="text" class="my-input" name="mobileNo" maxlength = "10" onkeypress="return isNumberKey(event);" placeholder="Enter 10 Digit No">


In the above code you can when you will press any key then an event will be generated which will call our defind function isNumericKey(). This function can return true or false.

JS

function isNumberKey(evt)
{
  var charCode = (evt.which) ? evt.which : event.keyCode
  return !(charCode > 31 && (charCode < 48 || charCode > 57));
}


The above function will allow only numeric value. We get the ascii code of the input value and then comparing this with the ascii values of the 0-9. If it satisfy the condition then it returns true otherwise false.

Here is the ascii values table you can see the decimal value with respect to their ascii code.

ASCII Table

Here are some tricky things before going to the ascii code part


Dec  = Decimal Value
Char = Character


Decimal values with their ascii codes
Dec  Char                           Dec  Char     Dec  Char     Dec  Char
---------                           ---------     ---------     ----------
  0  NUL (null)                      32  SPACE     64  @         96  `
  1  SOH (start of heading)          33  !         65  A         97  a
  2  STX (start of text)             34  "         66  B         98  b
  3  ETX (end of text)               35  #         67  C         99  c
  4  EOT (end of transmission)       36  $         68  D        100  d
  5  ENQ (enquiry)                   37  %         69  E        101  e
  6  ACK (acknowledge)               38  &         70  F        102  f
  7  BEL (bell)                      39  '         71  G        103  g
  8  BS  (backspace)                 40  (         72  H        104  h
  9  TAB (horizontal tab)            41  )         73  I        105  i
 10  LF  (NL line feed, new line)    42  *         74  J        106  j
 11  VT  (vertical tab)              43  +         75  K        107  k
 12  FF  (NP form feed, new page)    44  ,         76  L        108  l
 13  CR  (carriage return)           45  -         77  M        109  m
 14  SO  (shift out)                 46  .         78  N        110  n
 15  SI  (shift in)                  47  /         79  O        111  o
 16  DLE (data link escape)          48  0         80  P        112  p
 17  DC1 (device control 1)          49  1         81  Q        113  q
 18  DC2 (device control 2)          50  2         82  R        114  r
 19  DC3 (device control 3)          51  3         83  S        115  s
 20  DC4 (device control 4)          52  4         84  T        116  t
 21  NAK (negative acknowledge)      53  5         85  U        117  u
 22  SYN (synchronous idle)          54  6         86  V        118  v
 23  ETB (end of trans. block)       55  7         87  W        119  w
 24  CAN (cancel)                    56  8         88  X        120  x
 25  EM  (end of medium)             57  9         89  Y        121  y
 26  SUB (substitute)                58  :         90  Z        122  z
 27  ESC (escape)                    59  ;         91  [        123  {
 28  FS  (file separator)            60  <         92  \        124  |
 29  GS  (group separator)           61  =         93  ]        125  }
 30  RS  (record separator)          62  >         94  ^        126  ~
 31  US  (unit separator)            63  ?         95  _        127  DEL


Sunday, 27 March 2016

Difference between for and foreach loop in php

Difference between for and foreach loop in php 


These two loops are mainly used when you will work with array in php. You have worked with for and foreach loop in PHP, but do you know the difference between these two? Here they are described below:

for() 

for() loop is used when you know the number of times you have to loop. It means you know the loop termination counter in advance. Here is the Syntax of for loop

Syntax:

for (init counter; test counter; increment counter) 
{
    code to be executed;
}

Example:

<?php 
for ($x = 0; $x <= 5; $x++) 

{
    echo "The number is: $x <br>";
} 

?>

Output
0
1
2
3
4
5

foreach()


foreach() works only with the array. It is used when you have loop through the entire array. In this loop you do not need to specify the length of the array, array counter will automatically incremented to 1 after each element traversal.

foreach used with the associative array where you don't know the index of the array. In associative array elements are stored in the key/value pair when key can be any value either text or numeric.



Syntax:

foreach ($array as $value) {
    code to be executed;

}

Example:
<?php 
$colors = array("red", "green", "blue", "yellow"); 

foreach ($colors as $value) {
    echo "$value <br>";
}
?>

output: 
red 
green 
blue 
yellow 


foreach with associative array()

Associative array in which elements are stored in the form of key/pair value.
It is not like simple array where values are stores in the numerical indexs. In associative array you can store values in any type of index either numeric or text.

foreach() loop play vital role where key/index is a text value.

Here is the example demonstrate this

<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

foreach($age as $x => $x_value) {
    echo "Key=" . $x . ", Value=" . $x_value;
    echo "<br>";
}
?>

Output

Key= Peter, Value= 35
Key= Ben, Value=37
Key=Joe, Value=43

You can see in the above you can see that foreach loop itself walk through the entire array without increment counter. Pointer will automatically point to next element after each iteration. 

Friday, 25 March 2016

Unlink() vs Unset() in PHP, Difference

Unlink() vs Unset() in PHP, Difference


Unlink() vs Unset() in PHP, Difference

These function are mainly asked in interviews, Here is the difference between these two functions.

Unlink


In PHP, unlink() is used to completely delete files from the directory.

Syntax: unlink(filename,context) 

filename Required. Specifies the file to delete
context Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream


 Example: 

Create a file hello.txt with some content inside it and give permission wrx.

create a file name as filetest.php and paste the below content

<?php
$source         = "/var/www/myFolder/hello.txt";
unlink($source);
?>


Before running the script please change the file permission to rwx.
Now run this file in browser or php mytest.php for Linux user .

After performing the above operation you will see that the file you have created has deleted from the directory.


unset()


It is used to delete the content from a variable.

Syntax:  unset (var1, var2.... )

var1: name of variable to unset
var2: name of variable to unset[optional]

Example:

create a file name as filetest.php and paste the below content

<?php
$welcome_text = "Welcome to myblog";
unset($welcome_text);
if(isset($welcome_text)) 
{
    echo "My welcome text is:" . $welcome_text;
} else  
{
  echo "My welcome text is: empty";
}
?>


Before running the script please change the file permission to rwx.
Now run this file in browser or php mytest.php for Linux user .

When you run this script you see the output 


My welcome text is: empty


This is because you have unset the value of the variable 

After performing the above operation you will see that the file you have created has no contents inside it.



Please do comments if you have any query.







Image Insertion, Display from Database in using PHP and MYSQL

Image Insertion, Display from Database in using PHP and MYSQL

You have worked with CURD operation on data. Images are just the same but there are few things you need to learn


Follow these steps one after another

Step1: Create a Database named as mytest

Step2: Create a table inside this db named as images

Add three columns inside this table

id int(100) Auto Increment
image blob(1000000)
name varchar(50)


Step3: Create a file named as connect_db.php

Paste the below code there and save the file. You need to update the host, username, password, database name according to you.


<?php
$host     ="localhost";
$user     ="root";
$pass     ="google";
$db     ="mytest";
?>

This file stores the credentials of your database.

Step4:  Create a file named as image_insert.php

Paste the below code and save the file

<html>
    <head>
        <title>Image File Insertion in Database</title>
    </head>
    <body>
        <h3>Please Choose a File and click Submit</h3>

        <form enctype="multipart/form-data" action=
            "<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
            <input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
            <input name="imagefile" type="file" />
            <input type="submit" value="Submit" />
        </form>
    </body>
</html>

<?php
// check if a file was submitted
if(!isset($_FILES['imagefile']))
{
    echo '<p>Please select a file</p>';
}
else
{
    try
    {
        $msg     = uploadImage();  //this function will upload your image
        echo $msg;  //Message showing success or failure.
    }
    catch(Exception $e)
    {
        echo $e->getMessage();
        echo 'Due to some problem, Could not upload file';
    }
}

// ******** The Image upload function ***************** //

function uploadImage()
{
    include "connect_db.php";
    $maxsize = 10000000; //set to approx 10 MB

    //check associated error code
    if($_FILES['imagefile']['error'] == UPLOAD_ERR_OK) {

        //check whether file is uploaded with HTTP POST
        if(is_uploaded_file($_FILES['imagefile']['tmp_name'])) {   

            //checks size of uploaded image on server side
            if( $_FILES['imagefile']['size'] < $maxsize) { 
 
               //checks whether uploaded file is of image type
              //if(strpos(mime_content_type($_FILES['imagefile']['tmp_name']),"image")===0) {
                 $finfo = finfo_open(FILEINFO_MIME_TYPE);
                if(strpos(finfo_file($finfo, $_FILES['imagefile']['tmp_name']),"image")===0) {   

                    // prepare the image for insertion
                    $imgData =addslashes (file_get_contents($_FILES['imagefile']['tmp_name']));

                    // put the image in the db...
                    // database connection
                    mysql_connect($host, $user, $pass) OR DIE (mysql_error());

                    // select the db
                    mysql_select_db ($db) OR DIE ("Unable to select db".mysql_error());

                    // our sql query
                    $sql = "INSERT INTO images
                    (image, name)
                    VALUES
                    ('{$imgData}', '{$_FILES['imagefile']['name']}');";

                    // insert the image
                    mysql_query($sql) or die("Error in Query: " . mysql_error());
                    $msg = '<p>Image successfully saved in database with id ='. mysql_insert_id().' </p>';
                }
                else
                    $msg = "<p>Uploaded file is not an image.</p>";
            }
             else {
                // if the file is not less than the maximum allowed, print an error
                $msg = '<div>File exceeds the Maximum File limit</div>
                <div>Maximum File limit is '.$maxsize.' bytes</div>
                <div>File '.$_FILES['imagefile']['name'].' is '.$_FILES['imagefile']['size'].
                ' bytes</div><hr />';
                }
        }
        else
            $msg = "File not uploaded successfully.";

    }
    else {
        $msg = file_upload_error_message($_FILES['imagefile']['error']);
    }
    return $msg;
}

// Function to return error message based on error code

function file_upload_error_message($error_code) {
    switch ($error_code) {
        case UPLOAD_ERR_INI_SIZE:
            return 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
        case UPLOAD_ERR_FORM_SIZE:
            return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
        case UPLOAD_ERR_PARTIAL:
            return 'The uploaded file was only partially uploaded';
        case UPLOAD_ERR_NO_FILE:
            return 'No file was uploaded';
        case UPLOAD_ERR_NO_TMP_DIR:
            return 'Missing a temporary folder';
        case UPLOAD_ERR_CANT_WRITE:
            return 'Failed to write file to disk';
        case UPLOAD_ERR_EXTENSION:
            return 'File upload stopped by extension';
        default:
            return 'Unknown upload error';
    }
}
?>
</body>
</html>


Step5: Create a file named as file_display.php

<?php
 include "connect_db.php";
 // just so we know it is broken
 error_reporting(E_ALL);
 // some basic sanity checks
 if(isset($_GET['id']) && is_numeric($_GET['id']))
 {
     //connect to the database
     $conn = mysql_connect("$host", "$user", "$pass")
     or die("Could not connect: " . mysql_error());

     // select our database
     mysql_select_db("$db") or die(mysql_error());

     // get the image from the database
     $sql = "SELECT image FROM images WHERE id=" .$_GET['id'] . ";";

     // the result of the query
     $result = mysql_query("$sql") or die("Invalid query: " . mysql_error());

     // set the header for the image
     header("Content-type: image/jpeg");
     echo mysql_result($result, 0);

     // close the db connection
     mysql_close($conn);
 }
 else
 {
     echo 'Please use a numeric id number';
 }
?>

Step6: Open file Stored inside the database 

http://{path_to_your_web_directory}/file_display.php?id=1

For example:http://localhost/myFolder/file_display.php?id=1

Here id is the row id of the table
 

Saturday, 19 March 2016

Single Web Page Application Using AJAX, BOOTSTRAP, JAVASCRIPT, HTML, JQUERY

Single Web Page Application Using AJAX, BOOTSTRAP, JAVASCRIPT, HTML, JQUERY

Please follow the steps given below to build single web page application.

Step 1: Create a main.html file and paste the below code there

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Assigment</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- Latest compiled and minified CSS -->
<link rel="stylesheet"href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
     <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6   /js/bootstrap.min.js"></script>
        <script type="text/javascript" src ="main.js"></script>
        <link rel="stylesheet" href="secondary.css">
        <link rel="stylesheet" href="main.css">
    </head>

    <body>
    <!-- Header part -->
    <div class="container" style="">
        <div class="page-header-common">
             <div class="row">
                  <div class="col-sm-9" style="">
                      <a href="main.html" alt = "No Image Available"><img class="img-responsive" src="retailLending.jpg" alt="No Image Available" width="150" height="150"></a>
                  </div>
                  <div class="col-sm-2">
                      <p class = "customerName" style = "font:italic bold 15px Georgia, sans-serif;color:#3366cc;margin-top:15px;">  Mr. Anil Sawant </p>
                  </div>
                 
                  <div class="col-sm-1">
                      <img src="A1.png" class="img-rounded" alt="Image Not Available" width="55" height="55">
                  </div>
            </div>    
        </div>
    </div>
    <!-- End of header part -->
    <!-- Main data section start-->
    <div class="loadMainDataParent">
        <div id = "loadMainData" class="loadMainData">
            <div class="container-fluid">
                <div class="text-center">
                      <!-- <h4>Choose a card to add the detail</h4> -->
                </div>
                <div class="row" style="">
                    <div class="col-sm-1"></div>
                    <div class="col-sm-4">
                        <div class="panel panel-default text-center" id = "personalDetail" title = "ADD" onclick="addPersonalDetailClickHandler();">
                              <div id = "personalDetailHeader" class="panel-heading panel-heading-common">
                                    <h4>Personal Details</h4>
                              </div>
                              <div id = "personalDetailBody" class="panel-body panel-body-common">
                                  <div class="buttonPanelBody buttonPanelBodyCommon">
                                        <button type="button" class="btn btn-default btn-my-xl" id = "btnPersonalDetail">Add Details</button>
                                  </div>
                              </div>
                        </div>
                    </div>
                  <div class="col-sm-2"></div>
                      <div class="col-sm-4">
                          <div class="panel panel-default text-center" id = "propertyDetail" onclick="addPropertyDetailClickHandler();">
                              <div id = "propertyDetailHeader" class="panel-heading panel-heading-common">
                                    <h4>Property Details</h4>
                              </div>
                              <div id = "propertyDetailBody" class="panel-body panel-body-common">
                                  <div class="buttonPanelBody buttonPanelBodyCommon">
                                        <button type="button" class="btn btn-default btn-my-xl" id = "btnPropertylDetail">Add Details</button>
                                  </div>
                              </div>
                          </div>
                      </div>
                    <div class="col-sm-1"></div>
                </div>

               
                <div class="row cardRow2" style="">
                    <div class="col-sm-1"></div>
                    <div class="col-sm-4">
                        <div class="panel panel-default text-center" id = "workDetail" onclick="addWorkDetailClickHandler();">
                              <div id = "workDetailHeader" class="panel-heading panel-heading-common">
                                    <h4>Work Details</h4>
                              </div>
                              <div id = "workDetailBody" class="panel-body panel-body-common">
                                  <div class="buttonPanelBody buttonPanelBodyCommon">
                                    <button type="button" class="btn btn-default btn-my-xl" id = "btnWorkDetail">Add Details</button>
                                  </div>
                              </div>
                        </div>
                    </div>
                  <div class="col-sm-2"></div>

                    <div class="col-sm-4">
                        <div class="panel panel-default text-center" id = "otherDetail" onclick="addOtherDetailClickHandler();">
                              <div id = "otherDetailHeader" class="panel-heading panel-heading-common">
                                    <h4>Other Details</h4>
                              </div>
                              <div id = "otherDetailBody" class="panel-body panel-body-common">
                                  <div class="buttonPanelBody buttonPanelBodyCommon">
                                    <button type="button" class="btn btn-default btn-my-xl" id = "btnOtherDetail">Add Details</button>
                                  </div>
                              </div>
                        </div>
                    </div>
                    <div class="col-sm-1"></div>
                </div>
            </div>
        </div>
        <div class = "my-margin-footer"></div>
    </div>
    <!-- Main data section ends -->
    </body>
</html>

Step 1.2 Create a file named as propertyDetail.html and paste the below code

<div class="container">
  <div class="row">
    <nav class="col-sm-4">
      <ul class="nav nav-pills nav-stacked" data-spy="affix" data-offset-top="250">
        <li>
              <div class="panel panel-default text-center" id = "personalDetail" onclick="addPersonalDetailClickHandler();">
                      <div id = "personalDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Personal Details</h4>
                      </div>
                      <div id = "personalDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                                <button type="button" class="btn btn-default btn-my-xl" id = "btnPersonalDetail">Add Details</button>
                          </div>
                      </div>
              </div>
        </li>
        <li>
            <div class="panel panel-default text-center" id = "workDetail" onclick="addWorkDetailClickHandler();">
                      <div id = "workDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Work Details</h4>
                      </div>
                      <div id = "workDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                            <button type="button" class="btn btn-default btn-my-xl" id = "btnWorkDetail">Add Details</button>
                          </div>
                      </div>
                </div>
        </li>
        <li>
            <div class="panel panel-default text-center" id = "otherDetail" onclick="addOtherDetailClickHandler();">
                      <div id = "otherDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Other Details</h4>
                      </div>
                      <div id = "otherDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                            <button type="button" class="btn btn-default btn-my-xl" id = "btnOtherDetail">Add Details</button>
                          </div>
                      </div>
                </div>
          </li>
      </ul>
    </nav>

    <div class="col-sm-8">  
        <div class="panel panel-default text-center">
            <div id = "propertyDetailHeader" class="panel-heading panel-heading-common">
                  <h4>Property Details</h4>
            </div>
            <form role="form" class = "my-form" onsubmit="redirect_to_home_page()" method="post" enctype="multipart/form-data">
                <div class="panel-body main-form-body">              
                    <div class="form-group my-form-group">
                        <label>property Name:</label><br/>
                        <input type="text" class="my-input" id="name" name="name" placeholder="Type Full Name" required>
                        <hr>
                    </div>
                      <div class="form-group my-form-group">
                          <label> Type Of Property:</label><br/>
                          <input type="text" class="my-input" name="propertyType" placeholder="Type of property">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label> Size:</label><br/>
                          <input type="text" class="my-input" placeholder="Size" name="size">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>BHK:</label><br/>
                          <input type="email" class="my-input" placeholder="BHK (if flat)" name="bhk">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Location:</label><br/>
                          <input type="text" class="my-input" name = "location" placeholder="Type Here">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Landmark:</label><br/>
                          <input type="text" class="my-input" name = "landmark" placeholder="Type Here">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Price:</label><br/>
                          <input type="number" class="my-input" name = "price" placeholder="Type Here">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Locality & Area:</label><br/>
                          <input type="text" class="my-input" name = "localityArea" placeholder="Type Here" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>City Name:</label><br/>
                          <input type="text" class="my-input" id="cityName" name= "cityName" placeholder="Type City Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>State Name:</label>
                          <input type="text" class="my-input" id="stateName" name="stateName" placeholder="Type State Name" required>
                            <hr>   
                      </div>
                </div>
                <div id ="propertyDetailFooter" class="panel-footer panel-footer-commmon">
                      <input type="submit" class="btn btn-default my-submit-button" value="SUBMIT">
                </div>
            </form>
        </div>
    </div>
  </div>
</div>

Step 1.2 Create a file named as personalDetail.html and paste the below code

 <div class="container">
  <div class="row">
  <!-- Left Cards Menu -->
    <nav class="col-sm-4">
      <ul class="nav nav-pills nav-stacked" data-spy="affix" data-offset-top="250">
        <li>
              <div class="panel panel-default text-center" id = "propertyDetail" onclick="addPropertyDetailClickHandler();">
                      <div id = "propertyDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Property Details</h4>
                      </div>
                      <div id = "propertyDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                                <button type="button" class="btn btn-default btn-my-xl" id = "btnPropertylDetail">Add Details</button>
                          </div>
                      </div>
              </div>
        </li>
        <li>
            <div class="panel panel-default text-center" id = "workDetail" onclick="addWorkDetailClickHandler();">
                      <div id = "workDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Work Details</h4>
                      </div>
                      <div id = "workDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                            <button type="button" class="btn btn-default btn-my-xl" id = "btnWorkDetail">Add Details</button>
                          </div>
                      </div>
                </div>
        </li>
        <li>
            <div class="panel panel-default text-center" id = "otherDetail" onclick="addOtherDetailClickHandler();">
                      <div id = "otherDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Other Details</h4>
                      </div>
                      <div id = "otherDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                            <button type="button" class="btn btn-default btn-my-xl" id = "btnOtherDetail">Add Details</button>
                          </div>
                      </div>
                </div>
          </li>
      </ul>
    </nav>
   
    <!--  Main Card Data-->
    <div class="col-sm-8">  
        <div class="panel panel-default text-center">
            <div id = "personalDetailHeader" class="panel-heading panel-heading-common">
                  <h4>Personal Details</h4>
            </div>
            <form role="form" class = "my-form" onsubmit="redirect_to_home_page()" method="post" enctype="multipart/form-data">
                <div class="panel-body main-form-body">              
                    <div class="form-group my-form-group">
                        <label>Name:</label><br/>
                        <input type="text" id="name" class="my-input" name="name" placeholder="Type Full Name" required>
                        <hr>
                    </div>
                     <div class="form-group my-form-group">
                          <label> Gender:</label><br/>
                          <label>
                              <input type="radio" class="radio-inline" name="optradio" required>Male
                              <input type="radio" class="radio-inline" name="optradio">Female
                          </label>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label> DOB:</label><br/>
                          <input type="date" class="my-input" name="dob" placeholder="DD/MM/YYYY" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label> Mobile No:</label><br/>
                          <input type="text" class="my-input" name="mobileNo" maxlength = "10" onkeypress="return isNumberKey(event);" placeholder="Enter 10 Digit No">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label for="email">Email:</label><br/>
                          <input type="email" class="my-input" id="email" name = "email" placeholder="example@abc.com" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>PAN:</label><br/>
                          <input type="text" class="my-input" id="panNo" name = "panNo" placeholder="Enter PAN number" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>House No & Building Name:</label><br/>
                          <input type="text" class="my-input" id="houseNo" name = "houseNo" placeholder="Type House No and Building Name" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Street Name:</label><br/>
                          <input type="text" class="my-input" id="streetName" name = "streetName" placeholder="Type Street Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Locality & Area:</label><br/>
                          <input type="text" class="my-input" id="localityArea" name = "localityArea" placeholder="Type Locality and Area" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>City Name:</label><br/>
                          <input type="text" class="my-input" id="cityName" name= "cityName" placeholder="Type City Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>State Name:</label><br/>
                          <input type="text" class="my-input" id="stateName" name="stateName" placeholder="Type State Name" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Pin Code:</label><br/>
                          <input type="text" class="my-input" id="pinCode" name="pinCode" placeholder="Type Pin Code" onkeypress="return isNumberKey(event);" required>
                          <hr>
                      </div>              
                </div>
                <div id ="personalDetailFooter" class="panel-footer panel-footer-commmon ">
                      <input type="submit" class="btn btn-default my-submit-button" value="SUBMIT">
                </div>
            </form>
        </div>
    </div>
  </div>
</div>

Step 1.2 Create a file named as otherDetail.html and paste the below code

<div class="container">
  <div class="row">
    <nav class="col-sm-4">
      <ul class="nav nav-pills nav-stacked" data-spy="affix" data-offset-top="250">
        <li>
              <div class="panel panel-default text-center" id = "personalDetail" onclick="addPersonalDetailClickHandler();">
                      <div id = "personalDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Personal Details</h4>
                      </div>
                      <div id = "personalDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                                <button type="button" class="btn btn-default btn-my-xl" id = "btnPersonalDetail">Add Details</button>
                          </div>
                      </div>
              </div>
        </li>
         <li>
            <div class="panel panel-default text-center" id = "propertyDetail" onclick="addPropertyDetailClickHandler();">
                      <div id = "propertyDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Property Details</h4>
                      </div>
                      <div id = "propertyDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                                <button type="button" class="btn btn-default btn-my-xl" id = "btnPropertylDetail">Add Details</button>
                          </div>
                      </div>
              </div>
        </li>
        <li>
            <div class="panel panel-default text-center" id = "workDetail" onclick="addWorkDetailClickHandler();">
                      <div id = "workDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Work Details</h4>
                      </div>
                      <div id = "workDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                            <button type="button" class="btn btn-default btn-my-xl" id = "btnWorkDetail">Add Details</button>
                          </div>
                      </div>
                </div>
        </li>
      </ul>
    </nav>

    <div class="col-sm-8">  
        <div class="panel panel-default text-center">
            <div id = "otherDetailHeader" class="panel-heading panel-heading-common">
                  <h4>Other Details</h4>
            </div>
            <form role="form" class = "my-form" onsubmit="redirect_to_home_page()" method="post" enctype="multipart/form-data">
                <div class="panel-body main-form-body">              
                      <div class="form-group my-form-group">
                          <label>Mother Name:</label><br/>
                          <input type="text" class="my-input" id="motherName" name = "streetName" placeholder="Type Street Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Father Name:</label><br/>
                          <input type="text" class="my-input" name = "fatherName" placeholder="Type Street Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Interest:</label><br/>
                          <input type="text" class="my-input" name = "interest" placeholder="Type Locality and Area" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Best Lines</label><br/>
                          <input type="text" class="my-input" name= "bestLines" placeholder="Type City Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Favorite Songs</label><br/>
                          <input type="text" class="my-input" name="favSongs" placeholder="Type Here" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Favorite Movies</label><br/>
                          <input type="text" class="my-input" name="favMovie" placeholder="Type Here" required>
                          <hr>
                      </div>              
                </div>
                <div id ="otherDetailFooter" class="panel-footer panel-footer-commmon">
                      <input type="submit" class="btn btn-default my-submit-button" value="SUBMIT">
                </div>
            </form>
        </div>
    </div>
  </div>
</div>

Step 1.2 Create a file named as workDetail.html and paste the below code 

<div class="container">
  <div class="row">
    <nav class="col-sm-4">
      <ul class="nav nav-pills nav-stacked" data-spy="affix" data-offset-top="250">
        <li>
              <div class="panel panel-default text-center" id = "personalDetail" onclick="addPersonalDetailClickHandler();">
                      <div id = "personalDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Personal Details</h4>
                      </div>
                      <div id = "personalDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                                <button type="button" class="btn btn-default btn-my-xl" id = "btnPersonalDetail">Add Details</button>
                          </div>
                      </div>
              </div>
        </li>
        <li>
            <div class="panel panel-default text-center" id = "propertyDetail" onclick="addPropertyDetailClickHandler();">
                      <div id = "propertyDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Property Details</h4>
                      </div>
                      <div id = "propertyDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                                <button type="button" class="btn btn-default btn-my-xl" id = "btnPropertylDetail">Add Details</button>
                          </div>
                      </div>
              </div>
        </li>
        <li>
            <div class="panel panel-default text-center" id = "otherDetail" onclick="addOtherDetailClickHandler();">
                      <div id = "otherDetailHeader" class="panel-heading panel-heading-common">
                            <h4>Other Details</h4>
                      </div>
                      <div id = "otherDetailBody" class="panel-body panel-body-common-mini">
                          <div class="buttonPanelBody buttonPanelBodyCommonMini">
                            <button type="button" class="btn btn-default btn-my-xl" id = "btnOtherDetail">Add Details</button>
                          </div>
                      </div>
                </div>
          </li>
      </ul>
    </nav>

    <div class="col-sm-8">  
        <div class="panel panel-default text-center">
            <div id = "workDetailHeader" class="panel-heading panel-heading-common">
                  <h4>Work Details</h4>
            </div>
            <form role="form" class = "my-form" onsubmit="redirect_to_home_page()" method="post" enctype="multipart/form-data">
                <div class="panel-body main-form-body">              
                    <div class="form-group my-form-group">
                        <label>Company Name:</label><br/>
                        <input type="text" class="my-input" name="companyName" placeholder="Type Company Name" required>
                        <hr>
                    </div>
                      <div class="form-group my-form-group">
                          <label>Office No & Building Name:</label><br/>
                          <input type="text" class="my-input" name = "houseNo" placeholder="Type House No and Building Name" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Street Name:</label><br/>
                          <input type="text" class="my-input" name = "streetName" placeholder="Type Street Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Locality & Area:</label><br/>
                          <input type="text" class="my-input" name = "localityArea" placeholder="Type Locality and Area" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>City Name:</label><br/>
                          <input type="text" class="my-input" name= "cityName" placeholder="Type City Name">
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>State Name:</label><br/>
                          <input type="text" class="my-input" name="stateName" placeholder="Type State Name" required>
                          <hr>
                      </div>
                      <div class="form-group my-form-group">
                          <label>Pin Code:</label><br/>
                          <input type="number" class="my-input" name="pinCode" placeholder="Type Pin Code" required>
                          <hr>
                      </div>              
                </div>
                <div id ="workDetailFooter" class="panel-footer panel-footer-commmon">
                      <input type="submit" class="btn btn-default my-submit-button" value="SUBMIT">
                </div>
            </form>
        </div>
    </div>
  </div>
</div>
 

Step 2: CSS files
 
2.1 Create a file named as main.css and paste the below code

.image_inline
{
    float: right;
}
.form-group
{
    text-align: left;
}
.loadMainData
{
    margin-top: 50px;
}
.page-header-secondary
{
    margin-top:5px;
}
#personalDetailHeader
{
    background-color: #7070db;
    color:white;
}
#personalDetailBody
{
    background-color: #ccd9ff;
}
#personalDetail:hover
{
    cursor: pointer;
}
#personalDetail:hover #btnPersonalDetail
{
    color:#7070db;
}
#personalDetailFooter
{
    background-color: #7070db;
}

#propertyDetail:hover
{
    cursor: pointer;
}
#propertyDetail:hover #btnPropertylDetail
{
    color:#c44dff;
}
#propertyDetailHeader
{
    background-color: #c44dff;
    color:white;
}
#propertyDetailBody
{
    background-color: #f3ccff;
}
#propertyDetailFooter
{
    background-color: #c44dff;
}

#workDetail:hover
{
    cursor: pointer;
}
#workDetail:hover #btnWorkDetail
{
    color:#ffb366;
}
#workDetailHeader
{
    background-color: #ff944d;
    color:white;
}
#workDetailBody
{
    background-color: #ffe0cc;
}
#workDetailFooter
{
    background-color: #ffb366;
}

#otherDetail:hover
{
    cursor: pointer;
}
#otherDetail:hover #btnOtherDetail
{
    color:#77b300;
}
#otherDetailHeader
{
    background-color: #77b300;
    color:white;
}
#otherDetailBody
{
    background-color: #ddff99;
}
#otherDetailFooter
{
    background-color: #77b300;
}
.panel-heading-common
{
    height: 50px;
    box-shadow:0px 0px 15px
}

.panel-body-common
{
    height: 150px;
    border-bottom:2px solid #b3b3b3;
    border-top:2px solid white;
}
.page-header-common
{
    margin-top: 10px;
}
.buttonPanelBodyCommon
{
    margin-top: 35px;
}
.loadMainDataParent
{
    background-color: #e1eaea;
    border-top:5px solid #b3b3b3;
    /*border-bottom:5px solid #b3b3b3;*/
}
.cardRow2
{
    margin-top: 35px;
}
.panel-footer-commmon
{
    height:50px;
}
.btn-my-xl
{
    width:200px;
}
.my-margin-footer
{
    height:35px;
}

 2.2 Create a file named as secondary.css and paste the below code

 #personalDetailHeaderMini
{
    background-color: #3366cc;
    color:white;
}
#personalDetailBodyMini
{
    background-color: #9ab3e5;
}
#personalDetailMini:hover
{
    cursor: pointer;
}
#personalDetailMini:hover #btnPersonalDetail
{
    color:blue;
}
#personalDetailFooterMini
{
    background-color: #3366cc;
}

#propertyDetailMini:hover
{
    cursor: pointer;
}
#propertyDetailMini:hover #btnPropertylDetail
{
    color:purple;
}
#propertyDetailHeaderMini
{
    background-color: #c44dff;
    color:white;
}
#propertyDetailBodyMini
{
    background-color: #eeccff;
}
#propertyDetailFooterMini
{
    background-color: #c44dff;
}

#workDetailMini:hover
{
    cursor: pointer;
}
#workDetailMini:hover #btnWorkDetail
{
    color:#ffb366;
}
#workDetailHeaderMini
{
    background-color: #ffb366;
    color:white;
}
#workDetailBodyMini
{
    background-color: #ffd9b3;
}
#workDetailFooterMini
{
    background-color: #ffb366;
}

#otherDetailMini:hover
{
    cursor: pointer;
}
#otherDetailMini:hover #btnOtherDetail
{
    color:green;
}
#otherDetailHeaderMini
{
    background-color: #77b300;
    color:white;
}
#otherDetailBodyMini
{
    background-color: #eeffcc;
}
#otherDetailFooterMini
{
    background-color: #77b300;
}
.panel-heading-common-mini
{
    height: 30px;
}
.panel-body-common-mini
{
    height: 115px;
    border-bottom:2px solid #b3b3b3;
    border-top:2px solid white;
}
.panel-body-common-large
{
    height: 115px;
    border-bottom:2px solid #b3b3b3;
    border-top:2px solid white;
}
.page-header-common-mini
{
    margin-top: 4px;
}
.panel-heading-common-large
{
    border:2px solid #b3b3b3;
}
.panel-footer-common-large
{
    border:2px solid #b3b3b3;
}
.buttonPanelBodyCommonMini
{
    margin-top: 25px;
}
.affix
{
      top: 20px;
}
.main-form-body
{
        max-height:440px;overflow-y:scroll;
}
.panel-heading-common-mini
{
    height: 30px;
    box-shadow:0px 0px 15px
}
.my-submit-button
{
    width: 120px;
}
.my-form-group
{
    background-color: #f2f2f2;
}
.my-input
{
    width:700px;
    height:30px;
    border: none;
    background: transparent;
    background-color: transparent;
}
hr
{
    margin-top: 2px;
    border-top: 1px solid #666666;
}
Step 3: Javascript files

Create a file named as main.js and paste the below code in the file
 function addPersonalDetailClickHandler()
{
    $("#loadMainData").load("personalDetail.html", function( response, status, xhr ) {
      if(xhr.status == 401)
    {
          location.reload();
    }
    });
}
function addPropertyDetailClickHandler()
{
    $("#loadMainData").load("propertyDetail.html", function( response, status, xhr ) {
      if(xhr.status == 401)
    {
          location.reload();
    }
    });
}

function addWorkDetailClickHandler()
{
     $("#loadMainData").load("workDetail.html", function( response, status, xhr ) {
    if(xhr.status == 401)
    {
        location.reload();
    }
    });
}

function addOtherDetailClickHandler()
{
     $("#loadMainData").load("otherDetail.html", function( response, status, xhr ) {
    if(xhr.status == 401)
    {
        location.reload();
    }
    });
}

function redirect_to_home_page()
{
  window.location.href = "main.html";
}
function isNumberKey(evt)
{
  var charCode = (evt.which) ? evt.which : event.keyCode
  return !(charCode > 31 && (charCode < 48 || charCode > 57));
}
Step 5: Add images

Please add relevant images required in the files

Step 6: Open the main.html in the browser(HTML5 supported)



If you have faced any problem there please do comment.

Thanks for reading this article please do like :)
Tarun