QueryStrings
Overview: Query strings are a way to pass information with a link (url). Let's learn how to use query strings to pass information between PHP pages.
Q: What are querystings
Well querystring's are nothing but ordinary urls that have extra info (data) after the file name (Starts with a ? mark) basically A query string is the extra portion of the URL that appears after the question mark in a URL.
A sample Query String url from PHPBuddy http://www.phpbuddy.com/sub_articles.php?other_articles=10
To explain you I will take an example, we will create 2 pages the first page will have links with query string and the second page with process the info in the query string.
<html><body>
<a href=page_two.php?link=one>One</a>
<a href=page_two.php?link=two>two</a>
<a href=page_two.php?link=three>three</a>
</body></html>
In the above example we have created 3 hyperlinks with querystring "link=one", "link=two", "link=three" now we will create page_two.php where we will retrive the contents of that querystring.
page_two.php
<?php
$link = $_GET['link'];
echo "You have clicked $link";
?>
Home | Privacy Policy | Contact Us | Terms of Service
(c) 2002 - 2019 www.PHPbuddy.com Unauthorized reproduction/replication of any part of this site is prohibited.
|