Today we are starting some basic operations in PHP. In this article we will see INSERT, SEARCH, and SELECT queries in PHP. But it is mandatory that you have some knowledge about HTML and BOOTSTRAP.

  • HTML For Form Structured
  • BOOTSTRAP For Form Designing/Enhancement

Step 1: Now first we design the main employee form using HTML and bootstrap, which consists of some basic employee information. You can also make this form by adding some classes of bootstrap in the form.


Step 2: Now we make a database. First we are on APACHE and MQSQL; now open the Chrome browser and in the web address place type localhost and press enter. Now in the left side you can see that phpmyadmin is appearing; press click and left side; press new button;now give the database, and after that give the table name and numbers of columns. Now press GO; now give the column name, datatype, and number of the alphabet which you can takethe  maximum in the column, and then press the SAVE button. Now your database is ready.


Step 3: Now open Notepad++ make one file, and give the name connection.php. T give this four parameters for connection, which  essential, and then after that you type a code, save the file in htdocs folder which is located in xampp. Where you install the same make a new folder in htdocs and give the name EMPLOYEE and save this connection file in it. Then go to the browser and first write a localhost, then give your folder name and file name with file extension and press enter. If nothing appears  and the page is blank your connection is correct.

  • If you want to see your username go to the MYSQL database and click on PRIVILEGES.


Step 4: Now implement this code afterthe designing phase of the employee form and write this code after form coding. First we include the connection file which we make the separate file, then we put POST method to fetch the data from textboxes, and then we make a simple INSERT query.

INSERT query

Step 5: After writing the code now run the code using localhost and put all the necessary information into the textboxes and click on submit button. N the database is saved. In the database the alert message is appearing using JavaScript function. You can also see the data in the database also.

see the data


Step 6: Now we move to the second query which is known as SELECT query. Now first we add a connection file in our form, then we put a query to fetch out all the data from the database; here the information is the table name.


Now you can see that all the records in the database are displayed here:


Step 7: Now we move to the third query which is known as search query. In this query you put only the first name of the employee and all the records of the employee are displayed. Now we use get method because now we fetch record from database. I this way we need get method.


You can see that you can only give the first name of employee and all the records  of employee are displayed here but you should give the correct name with no spelling mistakes.

first name of employee