Wednesday, August 21, 2013

Make Advance Search Box using PHP And Ajax

Search Box Is The Most usefull in Social Networking Sites, Search Engine, Find Perticuler Keyword. so That You can Easily Make Search Box using PHP + AJAX in This Tutorials.

Index

  • Create Database and Table..
  • Create insert_data.php File.
  • Create Search.php File.
  • Create find.php File
  • Create Upload directory.
  • .Show Data On The Web Browser.

Create Database and Table.

Create a new file called upload.php. and Include The Jquery and Jquery form plugin into upload.php File.
<head>
    <title>File Upload With Jquery and PHP</title>
    <script type="text/javascript" src="jquery 1.3.2.js"></script>
    <script type="text/javascript" src="jquery.form.js"></script>
</head>
<script type="text/javascript">

    

  $(document).ready(function() {

  var options = {

  target: '#message', 

  url:'upload_process.php',

  beforeSubmit: function() {

  $('#uploader').html('<img src="ajax-loader.gif" border="0" />'); 

  },

  success:  function() {

  $('#uploader').html('');

  

  }

  };

  

  $('#upload').submit(function() {

  $(this).ajaxSubmit(options);

  return false;

  });


}); 

  </script>



<div id="message"></div>
    <form name="upload" id="upload"  method="POST" enctype="multipart/form-data">
        <table cellpadding="4" cellspacing="4" border="0">
            <tr>
                <td colspan="2"><h1>Upload File via Ajax</h1></td>
            </tr>
           <tr>
                <td class="fieldLabel" nowrap>File:</td>
                <td nowrap><input type="file" name="ufile" id="ufile" /></td>
            </tr>
            <tr>
                <td nowrap colspan="2"><input type="submit" id="uploadFile" value="Upload File" /></td>
            </tr>   
            
        </table>
    </form>
    <div id="uploader"></div>

 

2. Create upload_process.php file

upload_process file is the handle the file uploading Process.
 echo File Name: ''. $_FILES['ufile']['name'] .'</br>';
 echo File Type: ''. $_FILES['ufile']['type'] .'</br>'; 
 echo File Size(Byte): ''. $_FILES['ufile']['size'] .'</br>';

4. Display Image on The Web Browser