On Select, Fill The Div with Some Results (with the help of PHP and JavaScript)

Website and web application developers need to select an input to have some results in a div dynamically. So every option of selector would display results in the target div. These results would be scripted in another file.
Now how is it possible?

First need to create a selector having some options and a div which would be filled with the results.

Now JavaScript Code and would declare a file from where the result would be transferred to the target div.

Database Connection to Connect with MySql through PHP Programming language

Whenever we insert, update, delete or retrieve data from MySql dataabse, we need database connection. Different programming languages have different syntax to interact with database.

Database Connection with MySql through PHP Programming Language 

There are different drivers of PHP which are used to interact with MySql database.

PDO Driver


How Cookies to be Implemented in PHP Language

Session variable store values on the server side while cookie variable store on the user side (on computing device).

setcookie('remember_me',$_POST['ci'], time()+60*60*24*365, '/');


 <?php echo 'Hello'.$_COOKIE['remember_me']; ?>
<form method="post" action="">
<input name="user_id" type="tex" />
<input type="submit" />



Time and Date in PHP Programming Language

It is very  important to have time and date in website and applications, so here we would describe the method to display the time and date in PHP Programming language.

Date Without Time

  • Current Date
echo date("Y-m-d");
  • Current Year
echo date("Y");
  • Current Month
echo date("m");
  • Current Day/Date
echo date("d"); // result: If today is 2019-01-28 so result would be 28.

echo date("1");

We can describe it into words;

echo date("D"); // result: Suppose today is Thursday so result would be Thu.
  • First Date of Current Month
echo date("Y-m-01");
  • Last Date of Current Month
echo date("Y-m-t");


  • Current Time
echo date("h:i:sa");

Date with Time

  • Current Date and Time
echo date("Y-m-d h:i:sa");

Date Format

  • 1st Example
echo date("Y/m/d");
  • 2nd Example is One of Complete Format of Date and Time
echo date("l jS \of F Y h:i:s A");

Time Zone

Before displaying date in PHP programming language, need to define time zone as under;

It is compulsory to define time zone prior to display date.

echo date("Y-m-d");

Time zone name can be printed.

echo date_default_timezone_get();

Same value is stored in variable and displayed or inserted into database. Later it can be retrieved as per requirement.  If there is need to select data between two dates, the following query is used;

select * from table_name where date_column between $start_date and $end_date

If within ‘where’ clause,  there are more queries than one, so describe in this way;

select * from table_name where (date_column between $start_date and $end_date) and column_other = 'value_required'

(Note: The above ‘between’ condition is not only for date range but for range of any kind of data (in number).