{"id":106,"date":"2026-05-20T10:44:45","date_gmt":"2026-05-20T10:44:45","guid":{"rendered":"https:\/\/gigz.pk\/php\/?post_type=lesson&#038;p=106"},"modified":"2026-05-21T14:39:33","modified_gmt":"2026-05-21T14:39:33","slug":"get-method","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/php\/?lesson=get-method","title":{"rendered":"GET Method"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The GET method is used to send data from a web form to the server through the URL. It is one of the most commonly used HTTP request methods in PHP and web development.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When a user submits a form using the GET method, the form data becomes visible in the browser\u2019s address bar as query parameters.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By the end of this training, you will be able to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Understand the GET method in PHP<\/li>\n\n\n\n<li>Create forms using the GET method<\/li>\n\n\n\n<li>Retrieve user input using <code>$_GET<\/code><\/li>\n\n\n\n<li>Pass data through URLs<\/li>\n\n\n\n<li>Understand the advantages and limitations of GET requests<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What is the GET Method<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The GET method sends form data through the URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>example.com\/page.php?name=Ali&amp;city=Lahore<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>name=Ali<\/code><\/li>\n\n\n\n<li><code>city=Lahore<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">These are query parameters sent to the server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Syntax of GET Method<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">HTML Form Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form method=\"GET\" action=\"welcome.php\"&gt;<br>    &lt;input type=\"text\" name=\"username\"&gt;<br>    &lt;input type=\"submit\" value=\"Submit\"&gt;<br>&lt;\/form&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Accessing GET Data in PHP<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php<br>$username = $_GET&#91;'username'];<br><br>echo \"Welcome \" . $username;<br>?&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">How GET Method Works<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The user fills out the form<\/li>\n\n\n\n<li>The browser sends data through the URL<\/li>\n\n\n\n<li>PHP receives the data using the <code>$_GET<\/code> superglobal<\/li>\n\n\n\n<li>The server processes and displays the result<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Example of GET Method<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">HTML Form<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form method=\"GET\"&gt;<br>    Name: &lt;input type=\"text\" name=\"name\"&gt;<br>    &lt;input type=\"submit\"&gt;<br>&lt;\/form&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Code<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php<br>if(isset($_GET&#91;'name'])) {<br>    $name = $_GET&#91;'name'];<br>    echo \"Hello \" . $name;<br>}<br>?&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Sending Multiple Values<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form method=\"GET\"&gt;<br>    First Name: &lt;input type=\"text\" name=\"fname\"&gt;<br>    Last Name: &lt;input type=\"text\" name=\"lname\"&gt;<br>    &lt;input type=\"submit\"&gt;<br>&lt;\/form&gt;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php<br>$first = $_GET&#91;'fname'];<br>$last = $_GET&#91;'lname'];<br><br>echo $first . \" \" . $last;<br>?&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Advantages of GET Method<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Easy to Use<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">GET requests are simple and beginner friendly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Bookmarking<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">URLs with GET parameters can be bookmarked and shared.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Fast Data Transfer<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Suitable for small amounts of data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Useful for Search Pages<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Often used in search forms and filters.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Limitations of GET Method<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Data Visible in URL<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Information can be seen in the browser address bar.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Limited Data Length<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">URLs have character limits.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Less Secure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sensitive information should not be sent using GET.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Difference Between GET and POST<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Feature<\/th><th>GET<\/th><th>POST<\/th><\/tr><\/thead><tbody><tr><td>Data Location<\/td><td>URL<\/td><td>Request Body<\/td><\/tr><tr><td>Visibility<\/td><td>Visible<\/td><td>Hidden<\/td><\/tr><tr><td>Security<\/td><td>Less Secure<\/td><td>More Secure<\/td><\/tr><tr><td>Data Size<\/td><td>Limited<\/td><td>Large Amount<\/td><\/tr><tr><td>Bookmark Support<\/td><td>Yes<\/td><td>No<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use GET for search and filter forms<\/li>\n\n\n\n<li>Avoid sending passwords using GET<\/li>\n\n\n\n<li>Validate all user inputs<\/li>\n\n\n\n<li>Use <code>isset()<\/code> before accessing GET variables<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Real World Uses of GET Method<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Search forms<\/li>\n\n\n\n<li>Product filters<\/li>\n\n\n\n<li>Pagination<\/li>\n\n\n\n<li>URL parameters<\/li>\n\n\n\n<li>Website navigation<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Final Presentation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In your final presentation, explain:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What the GET method is<\/li>\n\n\n\n<li>How GET works in PHP<\/li>\n\n\n\n<li>How to create GET forms<\/li>\n\n\n\n<li>How to access data using <code>$_GET<\/code><\/li>\n\n\n\n<li>Advantages and disadvantages of GET<\/li>\n\n\n\n<li>Difference between GET and POST methods<\/li>\n<\/ul>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/php\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">Intermediate PHP > Forms Handling > GET Method<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1779273883181\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":29,"template":"","class_list":["post-106","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>GET Method - Learn PHP with GiGz.PK<\/title>\n<meta name=\"description\" content=\"Learn the PHP GET method with examples, form handling, URL parameters, and beginner friendly PHP tutorials.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/php\/?lesson=get-method\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GET Method - Learn PHP with GiGz.PK\" \/>\n<meta property=\"og:description\" content=\"Learn the PHP GET method with examples, form handling, URL parameters, and beginner friendly PHP tutorials.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/php\/?lesson=get-method\" \/>\n<meta property=\"og:site_name\" content=\"Learn PHP with GiGz.PK\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-21T14:39:33+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/php\\\/?lesson=get-method\",\"url\":\"https:\\\/\\\/gigz.pk\\\/php\\\/?lesson=get-method\",\"name\":\"GET Method - Learn PHP with GiGz.PK\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/php\\\/#website\"},\"datePublished\":\"2026-05-20T10:44:45+00:00\",\"dateModified\":\"2026-05-21T14:39:33+00:00\",\"description\":\"Learn the PHP GET method with examples, form handling, URL parameters, and beginner friendly PHP tutorials.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/php\\\/?lesson=get-method#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/php\\\/?lesson=get-method\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/php\\\/?lesson=get-method#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/php\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Intermediate PHP > Forms Handling > GET Method\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/php\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/php\\\/\",\"name\":\"Learn PHP with GiGz.PK\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/php\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GET Method - Learn PHP with GiGz.PK","description":"Learn the PHP GET method with examples, form handling, URL parameters, and beginner friendly PHP tutorials.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/php\/?lesson=get-method","og_locale":"en_US","og_type":"article","og_title":"GET Method - Learn PHP with GiGz.PK","og_description":"Learn the PHP GET method with examples, form handling, URL parameters, and beginner friendly PHP tutorials.","og_url":"https:\/\/gigz.pk\/php\/?lesson=get-method","og_site_name":"Learn PHP with GiGz.PK","article_modified_time":"2026-05-21T14:39:33+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/php\/?lesson=get-method","url":"https:\/\/gigz.pk\/php\/?lesson=get-method","name":"GET Method - Learn PHP with GiGz.PK","isPartOf":{"@id":"https:\/\/gigz.pk\/php\/#website"},"datePublished":"2026-05-20T10:44:45+00:00","dateModified":"2026-05-21T14:39:33+00:00","description":"Learn the PHP GET method with examples, form handling, URL parameters, and beginner friendly PHP tutorials.","breadcrumb":{"@id":"https:\/\/gigz.pk\/php\/?lesson=get-method#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/php\/?lesson=get-method"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/php\/?lesson=get-method#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/php"},{"@type":"ListItem","position":2,"name":"Intermediate PHP > Forms Handling > GET Method"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/php\/#website","url":"https:\/\/gigz.pk\/php\/","name":"Learn PHP with GiGz.PK","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/php\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/php\/index.php?rest_route=\/wp\/v2\/lesson\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/php\/index.php?rest_route=\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/php\/index.php?rest_route=\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/php\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}