Wednesday, October 1, 2014

1.2 About us

Coding of About us Page  :-

Header



Header is Divided into Two Parts

1.       Logo
2.       Menubar

Coding Part :


<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation | Welcome</title>
<link rel="stylesheet" href="css/foundation.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/vendor/modernizr.js"></script>
</head>
<body>

<!-- This is Border Class  -->

<div class="row border">
<div class="large-12">
<!-- This is The Logo  -->
<div class="row">
<div class="large-12">
<div class="large-4 columns">
<img src="img/logo.png">
</div>  <!—Logo Div Close-->

<!-- This is the Menu Bar -->
<div class="large-8 columns">
<nav class="top-bar" data-topbar role="navigation">
<section class="top-bar-section">

<!-- Left Nav Section -->
<ul class="left">
<li><a href="home.html">Home</a></li>
<li><a href="Aboutus.html">About us</a></li>
<li><a href="Services.html">Services</a></li>
<li><a href="Potfolio.html">Portfolio</a></li>
<li><a href="Contactus.html">Contact us</a></li>
</ul>
</section>
</nav>
</div>    <!--Menu Bar Div Close-->
</div>  <!--Class-12 Div Close-->
</div>  <!-- Row Div Close-->


<!--About us Banner-->



<!--Coding  -->

<div class="row">
<div class="large-12 columns">
<div class="myabout">
<h3>ABOUT US</h3>
</div>
</div>  <!--Div of Large-12  Closed-->
</div> <!--Div of Row is Closed-->




<!-- Content of the Part-->




<!--Coding of Content Part -->

<div class="row paragraph">
<div class="large-12">
<div class="large-8 columns">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>


<P>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>

<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>  <!--Div Large-8 Closed -->

<div class="large-4 columns">
<h5>
<b>Have a question?<b>
</h5>

<h6>Your name (required) </h6>
<input type="text" name="text" value=" ">

<h6>Your email (required) </h6>
<input type="text" name="text" value=" ">

<h6>Subject  </h6>
<input type="text" name="text" value=" ">

<textarea rows="6" cols="40"></textarea>

<input class="send" type="button" value="send">
</div>  <!--Div Large-4 of Content is Closed-->
</div>  <!--Div of Row is Closed-->
</div>  <!--Div of Row Paragraph is Closed-->


Footer



<!-- This is the Bottom of the Page-->
<div class="row">
<div class="large-12 columns">
<nav class="top-bar" data-topbar role="navigation">
<section class="top-bar-section">
<!-- Left Nav Section -->
<div class="myfooter">
<ul class="right">
<li><a href="home.html">Home</a></li>
<li><a href="Aboutus.html">About us</a></li>
<li><a href="Services.html">Services</a></li>
<li><a href="Potfolio.html">Portfolio</a></li>
<li><a href="Contactus.html">Contact us</a></li>
</ul> <!— Ul Tag of Menu Bar Part at Footer has been Closed  -->
</div>
</section>
</nav>
</div>  <!—Large-12  Div Closed-->
</div>  <!—Row Div Closed-->
</div>  <!—Large-12 Border Div Close-->
</div>  <!—Row Border Div Close-->
<script src="js/vendor/jquery.js"></script>
<script src="js/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
</body>              <!—Tag of Body Part has been End Here -->
</html>                               <!--Tag of Body Part has been End Here -->

Thursday, September 25, 2014

1st Project

 1. Header








Header is Divided into Two Parts

         Logo          

              Menubar



Coding Part :




<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation | Welcome</title>
<link rel="stylesheet" href="css/foundation.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/vendor/modernizr.js"></script>
</head>
<body>

<!-- This is Border class  -->


<div class="row">
<div class="large-12">

<!-- This is the logo  -->

<div class="row">
<div class="large-12">
<div class="large-4 columns">
<img src="img/logo.png">
</div>  <!—Logo Div Close-->




<!-- This is the Menu Bar -->

<div class="large-8 columns">
<nav class="top-bar" data-topbar role="navigation">
<section class="top-bar-section">

<!-- Left Nav Section -->

<ul class="left">
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</section>
</nav>
</div>    <!—Menu Bar Div Close-->
</div>   <!—Class-12 Div Close-->
</div>   <!— Row Div Close-->

</div>
</div>



2. Banner



Coding of Banner:-


<!-- This is the Banner-->


<div class="row">
<div class="large-12 columns">
<img src="img/banner.png">
</div>

</div>




3. Slider





Coding of the Slider:-


<!-- This is the Slider-->


<div class="row">
<div class="large-12 columns">
<ul class="example-orbit" data-orbit>
<li>
<img src="img/fox.png" alt="slide 1" />
<div class="orbit-caption">
Caption One.
</div>
</li>
<li class="active">
<img src="img/fox.png" alt="slide 2" />
<div class="orbit-caption">
Caption Two.
</div>
</li>
<li>
<img src="img/fox.png" alt="slide 3" />
<div class="orbit-caption">
Caption Three.
</div>
</li>

</ul>     <!—Unordered List Div Close-->

</div>   <!—Large-12  Div Close-->

</div>   <!—Row Div Close-->




4. Content Bar :-



Coding of the Content Bar:-


<!--This is the Content Bar   -->


<div class="row">
<div class="large-12 columns">
<div class="large-4 columns">
<img src="img/about.png">
<h4>About Us</h4>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</p>
</div>


<div class="large-4 columns">
<img src="img/services.png">
<h4>Services</h4>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</p>
</div>

<div class="large-4 columns">
<h4>Testimonial</h4>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</p>
</div>

</div>   <!—Large-12  Bar Div Close-->

</div>   <!—Row  Div Close-->






Monday, September 15, 2014

Project Work

How we can Make a Responsive Web Design


// Index Page




About Us Page




Services



Portfolio


Contact Us


Friday, September 5, 2014

Widget Creation in Wordpress

// Sidebar Footer Column in functions.php


register_sidebar( array(
'id' => 'Sidebar Footer smile-1',
'name' => __( 'Sidebar Footer smile', 'foundation' ),
'description' => __( 'This sidebar is located in column Smile of your theme footer.', 'foundation' ),
'before_widget' => '<div class="fl_left clear">',
'after_widget' => '</div>',
'before_title' => '<h5>',
'after_title' => '</h5>',
) );





// Call this widget in footer.php

<div class="wrapper row4">
  <div class="rnd">
    <div id="footer" class="clear">
      <!-- ####################################################################################################### -->
       <?php if ( dynamic_sidebar('Sidebar Footer smile') ) : elseif( current_user_can( 'edit_theme_options' ) ) : ?>

<h5><?php _e( 'No widgets found.', 'foundaton' ); ?></h5>
<p><?php printf( __( 'It seems you don\'t have any widgets in your sidebar! Would you like to %s now?', 'foundation' ), '<a href=" '. get_admin_url( '', 'widgets.php' ) .' ">populate your sidebar</a>' ); ?></p>
<?php endif; ?>
   
      <!-- ####################################################################################################### -->
    </div>
  </div>
</div>

Theam Options in Wordpress

// Make Changes in Theame Options.php file




//****=============================================================================****//
//****-----------This code is used for Box one Settings----------****//
//****=============================================================================****//

$options[] = array( "name" => "Home page",
"type" => "heading");

$options[] = array( "name" => "Box One Image",
"desc" => "Home page First Image",
"id" => "box_one_image",
"std" => "",
"type" => "upload");

$options[] = array( "name" => "Box One Heading",
"desc" => "Home page First Heading",
"id" => "box_one_heading",
"std" => "",
"type" => "text");

$options[] = array( "name" => "Box One Description",
"desc" => "Home page First Per",
"id" => "box_one_text",
"std" => "",
"type" => "textarea");


$options[] = array( "name" => "Box One  Read more Link",
"desc" => "Home page First Link",
"id" => "box_one_link",
"std" => "",
"type" => "text");

$options[] = array( "name" => "Box One  Read more Text",
"desc" => "Home page First Link Text",
"id" => "box_one_link_text",
"std" => "",
"type" => "text");







$options[] = array( "name" => "Box Two Image",
"desc" => "Home page First Image",
"id" => "box_two_image",
"std" => "",
"type" => "upload");

$options[] = array( "name" => "Box Two Heading",
"desc" => "Home page First Heading",
"id" => "box_two_heading",
"std" => "",
"type" => "text");

$options[] = array( "name" => "Box Two Description",
"desc" => "Home page First Per",
"id" => "box_two_text",
"std" => "",
"type" => "textarea");


$options[] = array( "name" => "Box Two Read more Link",
"desc" => "Home page First Link",
"id" => "box_two_link",
"std" => "",
"type" => "text");

$options[] = array( "name" => "Box Two Read more Text",
"desc" => "Home page First Link Text",
"id" => "box_two_link_text",
"std" => "",
"type" => "text");







$options[] = array( "name" => "social icon",
"type" => "heading");

$options[] = array( "name" => "icon-1",
"desc" => "facebook icon",
"id" => "icon-fb",
"std" => "",
"type" => "upload");


$options[] = array( "name" => "icon-2",
"desc" => "facebook google",
"id" => "icon-google",
"std" => "",
"type" => "upload");


















// Make this file in front-page.php



<div class="large-12 columns margin">
     
     
     
       <div class="large-4 medium-4 columns ">
<div class="box-border">
               
                 <?php if ( get_option('box_one_image') !='' ) { ?>
                 <img src="<?php echo get_option('box_one_image'); ?>" class="boximage" />
                        <?php } else { ?>
                   
                        <?php } ?>
                       

<div class="text">
                          <?php if ( get_option('box_one_heading') !='' ) { ?>
                <h5><?php echo get_option('box_one_heading'); ?></h5>
                        <?php } else { ?>
                 
                        <?php } ?>
                       
                       
<?php if ( get_option('box_one_text') !='' ) { ?>
                <p><?php echo get_option('box_one_text'); ?></p>
                        <?php } else { ?>
                 
                        <?php } ?>


<?php if ( get_option('box_one_link_text') !='' ) { ?>
               <a href="<?php echo get_option('box_one_link'); ?>" class="right"><?php echo get_option('box_one_link_text'); ?></a>
                        <?php } else { ?>
                 
                        <?php } ?>




</div>
</div>
    </div>
 
       <div class="large-4 medium-4 columns ">
<div class="box-border">

   <?php if ( get_option('box_two_image') !='' ) { ?>
                 <img src="<?php echo get_option('box_two_image'); ?>" class="boximage" />
                        <?php } else { ?>
                   
                        <?php } ?>
                       

<div class="text">
                          <?php if ( get_option('box_two_heading') !='' ) { ?>
                <h5><?php echo get_option('box_two_heading'); ?></h5>
                        <?php } else { ?>
                 
                        <?php } ?>
                       
                       
<?php if ( get_option('box_two_text') !='' ) { ?>
                <p><?php echo get_option('box_two_text'); ?></p>
                        <?php } else { ?>
                 
                        <?php } ?>


<?php if ( get_option('box_two_link_text') !='' ) { ?>
               <a href="<?php echo get_option('box_two_link'); ?>" class="right"><?php echo get_option('box_two_link_text'); ?></a>
                        <?php } else { ?>
                 
                        <?php } ?>




</div>
</div>
    </div>
</div>



Thursday, August 21, 2014

Make an HTML Page in Foundation 5

// Index.html


<!doctype html>
<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Foundation | Welcome</title>
    <link rel="stylesheet" href="css/foundation.css" />
    <link rel="stylesheet" type="text/css" href="style.css">
    <script src="js/vendor/modernizr.js"></script>
  </head>
  <body>
    <div class="row border">
    <div class="large-12">



<div class="row">

        <div class="large-12 medium-12 small-12 columns ">
     
        <div class="large-4 medium-4 small-12 scolumns">
        <img src="img/logo.png">
        </div><!-- Large-4 Div End-->
           
            <div class="large-8 medium-8 small-12 columns">
            <div class="off-canvas-wrap" data-offcanvas>
  <div class="inner-wrap">

    <a class="left-off-canvas-toggle" href="#" >Menu</a>

    <!-- Off Canvas Menu -->
    <aside class="left-off-canvas-menu">
        <!-- whatever you want goes here -->
        <ul>
          <li><a href="#">Item 1</a></li>
        ...
        </ul>
    </aside>

    <!-- main content goes here -->
 

  <!-- close the off-canvas menu -->
  <a class="exit-off-canvas"></a>

  </div>
</div>
            </div><!-- large-8 Class End-->
       
</div><!-- Large-12 Div End-->
       
     </div><!-- Row Div End-->
       
       
       
       
        <div class="row">
        <div class="large-12 medium-12 column">
            <img src="img/Untitled-1.png">
               
            </div>
        </div>
       
       
       
        <div class="row">
        <div class="large-12 medium-12 column">
            <ul class="example-orbit" data-orbit>
  <li>
    <img src="img/fox.png" alt="slide 1" />
    <div class="orbit-caption">
      Caption One.
    </div>
  </li>
  <li class="active">
    <img src="img/fox.png" alt="slide 2" />
    <div class="orbit-caption">
      Caption Two.
    </div>
  </li>
  <li>
    <img src="img/fox.png" alt="slide 3" />
    <div class="orbit-caption">
      Caption Three.
    </div>
  </li>
</ul>
               
            </div>
        </div>
       
       
       
       
       
        <div class="row">
        <div class="large-12 medium-12 small-12 columns">
        <div class="about_us_padding">
            <div class="large-4 medium-4 small-12 columns">
            <img src="img/about-us.png">
                <h3 class="font_walkway">About Us</h3>
                <p>
                The top bar is a pretty complex piece of magical UI goodness.
                The top bar is a pretty complex piece of magical UI goodness.
                </p>
            </div>
            <div class="large-4 medium-4 small-12 columns">
            <img src="img/Services.png">
                <h3>Services</h3>
                <p>
                The top bar is a pretty complex piece of magical UI goodness.
                The top bar is a pretty complex piece of magical UI goodness.
                </p>
            </div>
            <div class="large-4 medium-4 small-12 columns">
            <h3>Testimonials</h3>
                <p>
                The top bar is a pretty complex piece of magical UI goodness. We rely on many presentational classes to define its look and feel, and there's a lot happening in the JS. The top bar is hoverable by default, but you can change it use click events instead by adding.The top bar is a pretty complex piece of magical UI goodness.
                </p>
            </div>
        </div>
        </div>
        </div>
       
       
       
       
       
        <div class="row">
  <div class="large-12 columns">
    <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
    </div>
  </div>
       
       
       
       
       
       
       
        <div class="row">
        <div class="large-12 medium-12 small-12 column">
    <nav class="top-bar" data-topbar>
  <ul class="title-area">
    <li class="name">
      <h1><a href="#">Copy Right@2014 By TechNaitra</a></h1>
    </li>
     <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
    <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
  </ul>

  <section class="top-bar-section">
   

    <!-- Left Nav Section -->
    <ul class="right">
      <li><a href="#">Home</a></li>
                    <li><a href="#">About Us</a></li>
                    <li><a href="#">Services</a></li>
                    <li><a href="#">Portfolio</a></li>
                    <li><a href="#">Contact</a></li>
    </ul>

  </section>
</nav>      
       </div>
        </div>
     
       
</div></div>      
       
       

    <script src="js/vendor/jquery.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
      $(document).foundation();
    </script>
  </body>
</html>





















// Stle.css file


@charset "utf-8";
/* CSS Document */

.border{
-webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);}
.top-bar {

}
.about_us_padding{
margin:20px;
}
.font_walkway{
font-family:walkway;
}
.client {

 margin:0 0px;
  filter: grayscale(100%);
    -webkit-filter: grayscale(100%);  /* For Webkit browsers */
    filter: gray;  /* For IE 6 - 9 */
    -webkit-transition: all .6s ease;  /* Transition for Webkit browsers */
 opacity:0.5;
max-height: 65px;


}
.client:hover {
  filter: grayscale(0%);
    -webkit-filter: grayscale(0%);
    filter: none;
 opacity:1.0;
}




Image Blocks with hover Effects onto a page in Foundation 5

//Index.html page 

<div class="row">
  <div class="large-12 columns">
    <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
        <div class="large-3 columns">
        <a href="#" class="client"><img src="img/about-us.png"></a>
        </div>
    </div>
  </div>





//Style.CSS Page


.client {

 margin:0 0px;
  filter: grayscale(100%);
    -webkit-filter: grayscale(100%);  /* For Webkit browsers */
    filter: gray;  /* For IE 6 - 9 */
    -webkit-transition: all .6s ease;  /* Transition for Webkit browsers */
 opacity:0.5;
max-height: 65px;


}
.client:hover {
  filter: grayscale(0%);
    -webkit-filter: grayscale(0%);
    filter: none;
 opacity:1.0;
}

Page Border CSS in Foundation

.border
{
-webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);

}

Wednesday, November 20, 2013

Drop Down List in PHP

Create file Index.php and Paste the following code :
<?php
$con = mysql_connect('localhost', 'root', '');
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db('prem');
$query="SELECT * FROM country";
$result=mysql_query($query);
?>
<html>
<head>
<title>Country State City Dropdown Using Ajax</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
function getXMLHTTP() { //fuction to return the xml http object
                                var xmlhttp=false;          
                                try{
                                                xmlhttp=new XMLHttpRequest();
                                }
                                catch(e)               {                             
                                                try{                                        
                                                                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
                                                }
                                                catch(e){
                                                                try{
                                                                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                                                                }
                                                                catch(e1){
                                                                                xmlhttp=false;
                                                                }
                                                }
                                }
                                               
                                return xmlhttp;
    }
               
                function getState(countryId) {                  
                               
                                var strURL="findState.php?country="+countryId;
                                var req = getXMLHTTP();
                               
                                if (req) {
                                               
                                                req.onreadystatechange = function() {
                                                                if (req.readyState == 4) {
                                                                                // only if "OK"
                                                                                if (req.status == 200) {                                                                                  
                                                                                                document.getElementById('statediv').innerHTML=req.responseText;
                                                                                                document.getElementById('citydiv').innerHTML='<select name="city">'+
                                                                                                '<option>Select City</option>'+
                                                                        '</select>';                                                                                
                                                                                } else {
                                                                                                alert("Problem while using XMLHTTP:\n" + req.statusText);
                                                                                }
                                                                }                                                             
                                                }                                             
                                                req.open("GET", strURL, true);
                                                req.send(null);
                                }                             
                }
                function getCity(countryId,stateId) {                     
                                var strURL="findCity.php?country="+countryId+"&state="+stateId;
                                var req = getXMLHTTP();
                               
                                if (req) {
                                               
                                                req.onreadystatechange = function() {
                                                                if (req.readyState == 4) {
                                                                                // only if "OK"
                                                                                if (req.status == 200) {                                                                                  
                                                                                                document.getElementById('citydiv').innerHTML=req.responseText;                                                                                      
                                                                                } else {
                                                                                                alert("Problem while using XMLHTTP:\n" + req.statusText);
                                                                                }
                                                                }                                                             
                                                }                                             
                                                req.open("GET", strURL, true);
                                                req.send(null);
                                }
                                                               
                }
</script>

<style type="text/css">
body {font-family: Arial, "Trebuchet MS";font-size: 17px;color: #52B6EB; }
a{font-weight: bold;letter-spacing: -1px;color: #52B6EB;text-decoration:none;}
a:hover{color: #99A607;text-decoration:underline;}
#top{width:43%;margin-top: 25px; height:60px; border:1px solid #BBBBBB; padding:10px;}
#tutorialHead{width:43%;margin-top: 12px; height:30px; border:1px solid #BBBBBB; padding:11px;}
.tutorialTitle{width:95%;float:left;color:#99A607}
.tutorialTitle  a{float:right;margin-left:20px;}
.tutorialLink{float:right;}
table
{
margin-top:70px;
border: 1px solid #BBBBBB;
padding:25px;
height: 35px;
}
</style>
</head>
<body>
<form method="post" action="insert.php" name="form1">
<center>
<div id='top'>
         <a href="http://www.technaitra.com" title="Technaitra Solutions" target="blank">
             <img src="image/mainlogo.png" alt="Technaitra Solutions" title="Technaitra Solutions" border="0"/>
         </a>
</div>

    <div id='tutorialHead'>
         <div class="tutorialTitle"><b>Country State City Dropdown Using Ajax</b>
          <a href="http://phpwithsmile.blogspot.in" title="Country State City Dropdown Using Ajax">Tutorial Link</a>
    </div>
</div>


<table width="45%"  cellspacing="0" cellpadding="0">
  <tr>
    <td width="75">Country</td>
     <td width="50">:</td>
    <td  width="150"><select name="country" onChange="getState(this.value)">
                <option value="">Select Country</option>
                <?php while ($row=mysql_fetch_array($result)) { ?>
                <option value=<?php echo $row['id']?>><?php echo $row['country']?></option>
                <?php } ?>
                </select></td>
  </tr>
  <tr style="">
    <td>State</td>
    <td width="50">:</td>
    <td ><div id="statediv"><select name="state" >
                <option>Select State</option>
        </select></div></td>
  </tr>
  <tr style="">
    <td>City</td>
    <td width="50">:</td>
    <td ><div id="citydiv"><select name="city">
                <option>Select City</option>
        </select></div></td>
  </tr>
 
</table>
</center>

<input name="Submit" type="Submit" value="Submit">

</form>
</body>
</html>

Create file findstate.php and Paste the following code :


<?php
error_reporting(0);

$country=intval($_GET['country']);
$con = mysql_connect('localhost', 'root', '');
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db('prem');
$query="SELECT id,statename FROM state WHERE countryid='$country'";
$result=mysql_query($query);

?>
<select name="state" onchange="getCity(<?php echo $country?>,this.value)">
<option>Select State</option>
<?php while ($row=mysql_fetch_array($result)) { ?>
<option value=<?php echo $row['id']?>><?php echo $row['statename']?></option>
<?php } ?>
</select>

Create file findcity.php and Paste the following code :

<?php
error_reporting(0);

$countryId=intval($_GET['country']);
$stateId=intval($_GET['state']);
$con = mysql_connect('localhost', 'root', '');
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db('prem');
$query="SELECT id,city FROM city WHERE countryid='$countryId' AND stateid='$stateId'";
$result=mysql_query($query);

?>
<select name="city">
<option>Select City</option>
<?php while($row=mysql_fetch_array($result)) { ?>
<option value=<?php echo $row['id']?>><?php echo $row['city']?></option>
<?php } ?>
</select>

Create file insert.php and Paste the following code :

<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<?php
error_reporting(0);

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("prem", $con);

$sql="INSERT INTO result (country,state,city)
VALUES
('$_POST[country]','$_POST[state]','$_POST[city]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con);
?>

</body>
</html>


Database File:
Create Database with name prem and paste the following in SQL :
/* Create table country */

CREATE TABLE `country` (
  `id` tinyint(4) NOT NULL auto_increment,
  `country` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`id`)
)



/*create table state*/

CREATE TABLE `state` (
  `id` tinyint(4) NOT NULL auto_increment,
  `countryid` tinyint(4) NOT NULL,
  `statename` varchar(40) NOT NULL,
  PRIMARY KEY  (`id`)
)



/* Create table city */

CREATE TABLE `city` (
  `id` tinyint(4) NOT NULL auto_increment,
  `city` varchar(50) default NULL,
  `stateid` tinyint(4) default NULL,
  `countryid` tinyint(4) NOT NULL,
  PRIMARY KEY  (`id`)
)





/* Insert records into country table */

INSERT INTO `country` VALUES (1, 'USA');
INSERT INTO `country` VALUES (2, 'Canada');




/* Insert records into state table */

INSERT INTO `state` VALUES (1, 1, 'New York');
INSERT INTO `state` VALUES (2, 1, 'Los Angeles');
INSERT INTO `state` VALUES (3, 2, 'British Columbia');
INSERT INTO `state` VALUES (4, 2, 'Toranto');




/* Insert records into city table */

INSERT INTO `city` VALUES (1, 'Los Angales', 2, 1);
INSERT INTO `city` VALUES (2, 'New York', 1, 1);
INSERT INTO `city` VALUES (3, 'Toranto', 4, 2);
INSERT INTO `city` VALUES (4, 'Vancovour', 3, 2);


/* Create table Result*/

CREATE TABLE `result` (
  `id` tinyint(4) NOT NULL auto_increment,
  `city` varchar(50) default NULL,
   `state` varchar(50) default NULL,
 `country` varchar(50) default NULL,
  PRIMARY KEY  (`id`)
)