Query String in PHP:

The information or data can be also sent across the web pages through Query String. We can pass this Query String from one page to another page in the URL. You can identify the Query string in URL with question mark “?”. In URL after this mark “?” all data we can use in the next page.

In this topic we will learn how to send data through the link means how to send data via link tag “<a>”.

The Query String can contain two values : one is the id and other one is value of that id. After sending information via Query string the question is in mind “How to fetch the information?”. So don’t worry about it because we already learn how to fetch data when we use GET and POST method. Same as we have to use $_REQUEST, $_GET and $_POST variable to fetch information from URL. If you are using GET method in form than you can use $_GET variable and if you are using POST method in form than you can use $_POST variable or otherwise you can use $_REQUEST variable for both method.

You can also send several variables in URL.

Example:

In following example we are simply sending some data through Query String. This example is divided into two page.

First Page Coding : index.php

 Second Page Coding: send.php

 

Leave a Reply

Your email address will not be published. Required fields are marked *