Tuesday, April 17, 2012

Access Database with PDO(PHP Database Object)

Normally we use simple query to access the database with PHP. But the problem occurs when you have finished your project and after that decide to switching on the other Database?

The question stuck your mind for a while, and all the Database Queries have to modify again with another Database Compatible. To rid this problem simple start to build your project with PDO(PHP Database Object). PDO gives you the freedom to switch any database, to just change the connection string. Because PDO(PHP Database Object) supports a wide range of databases. You can find all the Supported Database Link in the given post.

Friday, April 6, 2012

ajax image upload

It is very old fashion to upload an image that select an image and click on the upload button to upload that image. And after that you will get the preview of that uploaded image. In this post we are talking about . Because ajax is used to create asynchronous web applications. Means ajax is sending and retrieving the data asynchronously(in the background) without refreshing the page.

With the use of ajax, just forget to click on the upload button.

Here is the link where you will find that how to create and instant image upload. Demo also available so that you will check how it looks like.

Click Here

Sunday, January 8, 2012

simple jquery, css drop down effect

In this post you will found that how to make simple jquery drop down effect on . For this first we will create the menus with the help of html and css. Here are some html :


After these html code now we have to give some styles like this:

Sunday, November 20, 2011

div scroll with jquery

Scrollable content area is looking more beautiful when we add some jquery events on it, beside this it will possible throught javascript as well, to make two functions that will call on the mouseover and the mouseout html attributes. But in this example we make it more easy with the help of .hover() event represented by jquery. You will found more about the .hover() event on the jquery official website.

 width: 500px;
 height: 200px;
 overflow: hidden;
 margin: 0 auto;
 padding: 3px;
 border: 2px solid #42826C;
 background: #A5C77F;
 font: 13px/18px Verdana, Arial, Helvetica, sans-serif;

Here is the html part:


Enter the text here as much as you want.

Now here is the jquery file:


Sunday, November 6, 2011

submit form without page refreshing using jquery, ajax and php

Ajax request is the most powerful feature of jquery, it helps to send data over the cross domain in the backend. In this post i give the very basic idea to submit a form with page refreshing and get the result. In this script i use some basic jquery and php. If you will apply this script in your own page then, I request you to validate all the data. Lets beautify the form with some CSS codes:

 font: 13px/18px Verdana, Arial, Helvetica, sans-serif;
 color: #666666;
 border: 1px solid #999999;
 padding: 2px;
 border: 1px solid #999999;
 padding: 2px;
 resize: none;
 border: 1px solid #999999;
 font: bold 13px/18px Verdana, Arial, Helvetica, sans-serif;
 color: #666666;
 padding: 3px 10px;

Here is the basic form layout:


I use table to prevent the browser confliction bug. Now lets start with some jquery stuff, before applying this stuff please insert the jquery source file from jquery official site or form ajax google api.

  var query = $('#myform').serialize();
   url: 'ajaxForm.php',
   data: query,
   success: function(data){
      if(data == 'send'){
       $('.result').html('Data Send Successfully!');
       $('.result').html('Error to Send Data!');

Now as you see in the above jquery codes that i request the a ajaxForm.php page through ajax request which handles all the data and return the result.

 $name = (isset($_REQUEST['name'])) ? $_REQUEST['name'] : NULL;
 $email = (isset($_REQUEST['email'])) ? $_REQUEST['email'] : NULL;
 $subject = (isset($_REQUEST['subject'])) ? $_REQUEST['subject'] : NULL;
 $query = (isset($_REQUEST['query'])) ? $_REQUEST['query'] : NULL;
 if( !empty($name) && !empty($email) && !empty($subject) && !empty($query) ){
  echo 'send';

Related Posts Plugin for WordPress, Blogger...