{"id":5780,"date":"2021-03-27T12:36:41","date_gmt":"2021-03-27T12:36:41","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5780"},"modified":"2021-03-27T12:37:29","modified_gmt":"2021-03-27T12:37:29","slug":"_get-and-_post-variable-in-php","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/","title":{"rendered":"$_GET and $_POST Variable in PHP"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li>$_GET and $_POST is generally used in the forms to transfer data from one file to another file. Both the variables are kind of same except when we need to keep our data secure we use $_POST and generally in the form we use $_POST.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">We will see the explanation by a example:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Form.html<\/span><\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Joydeep-cotocus\/5f21d2415e74cbe7c5809be04bbb7e4c.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Testform.php<\/span><\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Joydeep-cotocus\/9e67b2d791cff11c8e3e74b3752ec8fa.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\">In this form we have used &#8220;<strong>get&#8221;<\/strong> method and we will see the output below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"639\" height=\"375\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg\" alt=\"\" class=\"wp-image-5750\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg 639w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11-300x176.jpg 300w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"327\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-12.jpg\" alt=\"\" class=\"wp-image-5751\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-12.jpg 508w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-12-300x193.jpg 300w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see we have used the method &#8220;<strong>get<\/strong>&#8221; in the form and in the output page of testform.php we can see the input given, also with that in the URL box we can see the details which we have provided in the form.html.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we use &#8220;<strong>post<\/strong>&#8221; method in the form.html we will see the difference below:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Joydeep-cotocus\/9870ae337e5d82f7959e3c4c4d0330c7.js\"><\/script>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Joydeep-cotocus\/dd56adf2588ad8404266028b3f4e0145.js\"><\/script>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"257\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-13.jpg\" alt=\"\" class=\"wp-image-5752\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-13.jpg 438w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-13-300x176.jpg 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see in the URL box there is no such details provided which we can see while using &#8220;<strong>post<\/strong>&#8221; method.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>$_GET and $_POST is generally used in the forms to transfer data from one file to another file. Both the [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[453],"tags":[1663,177,5162,317],"class_list":["post-5780","post","type-post","status-publish","format-standard","hentry","category-programming-scripting-languages","tag-get","tag-php","tag-post","tag-variables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>$_GET and $_POST Variable in PHP - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"$_GET and $_POST Variable in PHP - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"$_GET and $_POST is generally used in the forms to transfer data from one file to another file. Both the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-27T12:36:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-27T12:37:29+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg\" \/>\n<meta name=\"author\" content=\"Joydeep M\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joydeep M\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/\"},\"author\":{\"name\":\"Joydeep M\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/8a2c0533775223a96dd307662111bac6\"},\"headline\":\"$_GET and $_POST Variable in PHP\",\"datePublished\":\"2021-03-27T12:36:41+00:00\",\"dateModified\":\"2021-03-27T12:37:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/\"},\"wordCount\":162,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/Capture-11.jpg\",\"keywords\":[\"Get\",\"Php\",\"Post\",\"Variables\"],\"articleSection\":[\"Programming Scripting Languages\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/\",\"name\":\"$_GET and $_POST Variable in PHP - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/Capture-11.jpg\",\"datePublished\":\"2021-03-27T12:36:41+00:00\",\"dateModified\":\"2021-03-27T12:37:29+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/8a2c0533775223a96dd307662111bac6\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/Capture-11.jpg\",\"contentUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/Capture-11.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/_get-and-_post-variable-in-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"$_GET and $_POST Variable in PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/8a2c0533775223a96dd307662111bac6\",\"name\":\"Joydeep M\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g\",\"caption\":\"Joydeep M\"},\"description\":\"An investment in knowledge pays the best interest.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/joydeep-kumar-538412208\\\/\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/joydeep\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"$_GET and $_POST Variable in PHP - scmGalaxy","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:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/","og_locale":"en_US","og_type":"article","og_title":"$_GET and $_POST Variable in PHP - scmGalaxy","og_description":"$_GET and $_POST is generally used in the forms to transfer data from one file to another file. Both the [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/","og_site_name":"scmGalaxy","article_published_time":"2021-03-27T12:36:41+00:00","article_modified_time":"2021-03-27T12:37:29+00:00","og_image":[{"url":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg","type":"","width":"","height":""}],"author":"Joydeep M","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Joydeep M","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/"},"author":{"name":"Joydeep M","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/8a2c0533775223a96dd307662111bac6"},"headline":"$_GET and $_POST Variable in PHP","datePublished":"2021-03-27T12:36:41+00:00","dateModified":"2021-03-27T12:37:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/"},"wordCount":162,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#primaryimage"},"thumbnailUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg","keywords":["Get","Php","Post","Variables"],"articleSection":["Programming Scripting Languages"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/","name":"$_GET and $_POST Variable in PHP - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#primaryimage"},"thumbnailUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg","datePublished":"2021-03-27T12:36:41+00:00","dateModified":"2021-03-27T12:37:29+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/8a2c0533775223a96dd307662111bac6"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#primaryimage","url":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg","contentUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/Capture-11.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/_get-and-_post-variable-in-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"$_GET and $_POST Variable in PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/8a2c0533775223a96dd307662111bac6","name":"Joydeep M","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fb490db5d492c960456cc628f9e832fda72c5bc426cd8a13b18cbb95bca7ce99?s=96&d=mm&r=g","caption":"Joydeep M"},"description":"An investment in knowledge pays the best interest.","sameAs":["https:\/\/www.linkedin.com\/in\/joydeep-kumar-538412208\/"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/joydeep\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5780"}],"version-history":[{"count":2,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5780\/revisions"}],"predecessor-version":[{"id":5782,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5780\/revisions\/5782"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}