{"id":28387,"date":"2017-03-16T03:01:34","date_gmt":"2017-03-15T17:01:34","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=28387"},"modified":"2017-03-15T21:20:52","modified_gmt":"2017-03-15T11:20:52","slug":"html-form-get-and-post-via-php-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-form-get-and-post-via-php-primer-tutorial\/","title":{"rendered":"HTML Form Get and Post via PHP Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/get_post.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"HTML Form Get and Post via PHP Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/get_post.jpg\" title=\"HTML Form Get and Post via PHP Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">HTML Form Get and Post via PHP Primer Tutorial<\/p><\/div>\n<p>An HTML form element allows for <i>method<\/i> property values of &#8230;<\/p>\n<ul>\n<li>GET<\/li>\n<li>POST<\/li>\n<\/ul>\n<p> &#8230; the latter of which requires a server-side language to glean the HTML form element&#8217;s data.<\/p>\n<p>So we are writing today&#8217;s tutorial in PHP, and our aim here is to point out that it is within the scope of PHP to be more flexible than to say the HTML form element data is <i>GET<\/i> or <i>POST<\/i>, but our point today is to show you you can write PHP code to process HTML form element data in a <i>GET<\/i> and\/or <i>POST<\/i> way.<\/p>\n<p>Let&#8217;s start by showing you some PHP we got helped out with by <a target=_blank title='PHP Get and Post generic reading' href='http:\/\/stackoverflow.com\/questions\/7163815\/get-name-of-a-post-variable'>this very useful link<\/a>, thanks, as per &#8230;<\/p>\n<p><code><br \/>\n&lt;?php<br \/>\nforeach ($_POST as $name =&gt; $val) {<br \/>\n     echo \"POST ... \" . htmlspecialchars($name . ': ' . $val) . \"&lt;br&gt;\";<br \/>\n}<br \/>\nforeach ($_GET as $name =&gt; $val) {<br \/>\n     echo \"GET ... \" . htmlspecialchars($name . ': ' . $val) . \"&lt;br&gt;\";<br \/>\n}<br \/>\n?&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; to be &#8220;generic&#8221; about (ie. nothing about the data&#8217;s <i>name<\/i> is of concern to us <font size=1>&#8230; just yet<\/font>) the specifics of data, but allowing for either <i>method<\/i> of data transmission to be allowed and processed for.<\/p>\n<p>And so we start on our investigations on this pretty important concept regarding these fairly conventional HTML navigation techniques.  There is a fair bit more to consider, but you can try this &#8220;proof of concept&#8221; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/get_post.php\" title=\"Click picture\">web application<\/a> you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/get_post.php_GETME\">get_post.php<\/a> for your perusal.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d28387' onclick='var dv=document.getElementById(\"d28387\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/form\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d28387' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>An HTML form element allows for method property values of &#8230; GET POST &#8230; the latter of which requires a server-side language to glean the HTML form element&#8217;s data. So we are writing today&#8217;s tutorial in PHP, and our aim &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-form-get-and-post-via-php-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[452,1533,576,652,830,932,970],"class_list":["post-28387","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-form","tag-get","tag-html","tag-javascript","tag-navigation","tag-php","tag-post"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28387"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=28387"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28387\/revisions"}],"predecessor-version":[{"id":28391,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28387\/revisions\/28391"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=28387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=28387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=28387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}