{"id":14574,"date":"2016-09-08T16:15:00","date_gmt":"2016-09-08T13:15:00","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=14574"},"modified":"2018-01-09T10:29:56","modified_gmt":"2018-01-09T08:29:56","slug":"php-form-action-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/","title":{"rendered":"PHP Form Action Example"},"content":{"rendered":"<p>In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user&#8217;s send data to a server or website.<\/p>\n<p>If a website needs to collect a user name, age or date of birth it&#8217;s most likely going to use HTML forms. Login and registration systems for websites are built with html forms.<br \/>\nFor this example we will use:<\/p>\n<ol>\n<li>A computer with PHP&gt;= 5.5 installed<\/li>\n<li>notepad++<\/li>\n<\/ol>\n<p>&nbsp;<br \/>\n[ulp id=&#8217;8njY7i2QRy6sg8pg&#8217;]<\/p>\n<h2>1. Creating HTML forms<\/h2>\n<p>HTML forms are created with the opening <code>&lt;form&gt;<\/code> and closing <code>&lt;\/form&gt;<\/code><\/p>\n<p><code><\/code> tag. The<code>form<\/code> tag defines an html form.<br \/>\nForm elements are different, they can be text fields, checkboxes, radio buttons, submit buttons, and more.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index.html<\/em><\/span><\/p>\n<pre class=\"brush:html; highlight:[23]\">           \r\n&lt;!DOCTYPE html&gt; \r\n&lt;html lang=eng&gt;\r\n\t&lt;head&gt;\r\n\t&lt;style&gt;\r\n\thtml, body{\r\n\twidth:100%;\r\n\theight:100%;\r\n\tmargin:0%;\r\n\tfont-family:\"helvetica\",\"verdana\",\"calibri\", \"san serif\";\r\n\toverflow:hidden;\r\n\tpadding:0%;\r\n\tborder:0%;\r\n\t}\r\n\t \r\n\t&lt;\/style&gt;\r\n\t \t\t&lt;meta charset=\"utf-8\" \/&gt;\r\n\t\t&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi\"\/&gt;\r\n\t\r\n\t&lt;title&gt;HTML Form&lt;\/title&gt;\r\n\t\r\n\t&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;form action=\"index.php\" method =\"post\"&gt;\r\nName: \r\n&lt;input type =\"text\" name =\"name\" required&gt;\r\n&lt;br&gt;\r\nE-mail: \r\n&lt;input type =\"email\" name =\"email\" required&gt;\r\n&lt;br&gt;\r\n&lt;input type=\"submit\" value=submit&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>The code above creates an html form. The &#8220;action&#8221; attribute in the form tag(line 23) tells the form where to submit it&#8217;s content while the &#8220;method&#8221; attribute let&#8217;s the form know which method to use when transmitting it&#8217;s content. The method attribute can either be <code>GET<\/code>or <code>POST<\/code><\/p>\n<h2>1.1 GET Method<\/h2>\n<ul>\n<ul>\n<li>The get method is visible to everyone<\/li>\n<li>The GET method sends encoded user information appended to the page. e.g <code> http:\/\/www.server.com\/index.htm?name1=value<\/code><\/li>\n<li>The GET method has a limitation of about 2000 characters<\/li>\n<li>The GET method should never be used to transmit sensitive information(e.g passwords)<\/li>\n<li>PHP provides $_GET associative array to access all the data sent using GET method.<\/li>\n<\/ul>\n<\/ul>\n<p><span style=\"text-decoration: underline;\"><em>index1.html<\/em><\/span><\/p>\n<pre class=\"brush:html;\">   \r\n&lt;!DOCTYPE html&gt; \r\n&lt;html lang=eng&gt;\r\n\t&lt;head&gt;\r\n\t&lt;style&gt;\r\n\thtml, body{\r\n\twidth:100%;\r\n\theight:100%;\r\n\tmargin:0%;\r\n\tfont-family:\"helvetica\",\"verdana\",\"calibri\", \"san serif\";\r\n\toverflow:hidden;\r\n\tpadding:0%;\r\n\tborder:0%;\r\n\t}\r\n\t \r\n\t&lt;\/style&gt;\r\n\t \t\t&lt;meta charset=\"utf-8\" \/&gt;\r\n\t\t&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi\"\/&gt;\r\n\t\r\n\t&lt;title&gt;HTML Form&lt;\/title&gt;\r\n\t\r\n\t&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;form action=\"index.php\" method =\"get\"&gt;\r\nName: &lt;br&gt;\r\n&lt;input type =\"text\" name =\"name\" required&gt;\r\n&lt;br&gt;\r\nCar: &lt;br&gt;\r\n&lt;select name =\"cars\"&gt;\r\n&lt;option value=\"volvo\"&gt; Volvo &lt;\/\r\noption&gt;\r\n&lt;option value=\"saab\"&gt; Saab &lt;\/\r\noption &gt;\r\n&lt;option value=\"fiat\"&gt; Fiat &lt;\/\r\noption &gt;\r\n&lt;option value=\"audi\"&gt; Audi &lt;\/\r\noption&gt;\r\n&lt;\/select&gt;\r\n&lt;br&gt;\r\n&lt;input type=\"submit\" value=submit&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>The code above shows a form with form action GET.<\/p>\n<h2>1.2 POST Method<\/h2>\n<ul>\n<ul>\n<ul>\n<ul>\n<li>Information sent with POST is invisible to others<\/li>\n<li>It has no limitations on data size<\/li>\n<li>PHP provides $_POST associative array to access all the information sent using POST method<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<\/ul>\n<h2>1.3 Handling forms data with PHP<\/h2>\n<p>We have learnt how to create HTML forms and how data in HTML forms are sent to the server. How do we write a script that handles and manipulates the form data when it arrives at the server?<br \/>\nFirst of all, the form action attribute needs to contain the URL of the PHP script that will handle the form. e.g <code> &lt;form action=\"index.php\" method =\"post\"&gt;<\/code>.<br \/>\nNext we need to create the form handler (index.php). When the form data gets to the server the script &#8220;index.php&#8221; is called. The script then needs to read the form data and act on it. We use <code>$_GET<\/code> and <code>$_POST<\/code> superglobal arrays<\/p>\n<ul>\n<ul>\n<ul>\n<ul>\n<li>$_GET: Contains a list of all the field names and values sent by a form using the GET method<\/li>\n<li>$_POST: Contains a list of all the field names and values sent by a form using the POST method.<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<\/ul>\n<p>For example we have created a form using the GET method and the form contains a text field<br \/>\n<code>&lt; input type=text name=text &gt;<\/code>.<br \/>\nWe can access the data in this form field by using the<code> $_GET <\/code> superglobal array<br \/>\n<code>$text=$_GET[\"text\"];<\/code><\/p>\n<p><span style=\"text-decoration: underline;\"><em>index2.html<\/em><\/span><\/p>\n<pre class=\"brush:html;\">  \r\n&lt;!DOCTYPE html&gt; \r\n &lt;html lang=\u201den\u201d&gt; \r\n &lt;head&gt;    \r\n &lt;title&gt;Membership Form&lt;\/title&gt;     \r\n&lt;\/head&gt;\r\n &lt;body&gt;    \r\n &lt;h1&gt;Membership Form&lt;\/h1&gt;\r\n    &lt;p&gt;Thanks for choosing to join The Programming Language Club.&lt;\/p&gt;\r\n    &lt;form action=index.php method=post&gt;   \r\n\t&lt;div style=\"width: 30em;\" &gt;\r\n        &lt;label for=firstName&gt;First name&lt;\/label&gt;&lt;br&gt;        &lt;input type=text name=firstName id=firstName required \/&gt;&lt;br&gt;&lt;br&gt;\r\n        &lt;label for=lastName&gt;Last name&lt;\/label&gt; &lt;br&gt;       &lt;input type=text name=lastName id=lastName  required\/&gt;&lt;br&gt;&lt;br&gt;\r\n        &lt;label for=password1&gt;Choose a password&lt;\/label&gt; &lt;br&gt;       &lt;input type=password name=password1 id=password1 required \/&gt; &lt;br&gt;  &lt;br&gt;  \r\n\t\t&lt;label for=password2&gt;Retype password&lt;\/label&gt;&lt;br&gt;        &lt;input type=password name=password2 id=password2 required \/&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=genderMale&gt;Are you male...&lt;\/label&gt;        &lt;input type=radio name=gender id=genderMale value=Male \/&gt;       \r\n\t\t&lt;label for=genderFemale&gt;...or female?&lt;\/label&gt; &lt;input type=radio name=gender id=genderFemale value=Female checked \/&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=favoriteWidget&gt;What's your favorite language?&lt;\/label&gt;        &lt;select name=favoriteWidget id=favoriteWidget size=1&gt;        \r\n\t\t&lt;option value=java&gt;Java&lt;\/option&gt;     \r\n\t\t&lt;option value=php&gt;PHP&lt;\/option&gt;          \r\n\t\t&lt;option value=phyton&gt;PHYTON&lt;\/option&gt;     \r\n\t\t&lt;\/select&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=newsletter&gt;Do you want to receive our newsletter?&lt;\/label&gt;        \r\n\t\t&lt;input type=checkbox name=newsletter id=newsletter value=yes \/&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=comments&gt;Any comments?&lt;\/label&gt;       \r\n\t\t&lt;textarea name=comments id=comments rows=4 cols=50&gt; &lt;\/textarea&gt;\r\n        &lt;div style=\u201dclear: both;\u201d&gt;         \r\n\t&lt;input type=submit name=submitButton id=submitButton value=Send Details \/&gt;       \r\n\t&lt;input type=reset name=resetButton id=resetButton value=\"Reset Form\" style=\"margin-right: 20px;\" \/&gt;      \r\n\t&lt;\/div&gt;     \r\n\t&lt;\/div&gt;   \r\n\t&lt;\/form&gt;\r\n  &lt;\/body&gt; &lt;\/html&gt;\r\n\r\n<\/pre>\n<p>This is a simple\/trivial registration form and below is the code for manipulating the form data.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index.php<\/em><\/span><\/p>\n<pre class=\"brush:php;\">  \r\n&lt;!DOCTYPE html&gt; \r\n &lt;html lang=\u201den\u201d&gt; \r\n &lt;head&gt;    \r\n &lt;title&gt;Membership Form&lt;\/title&gt;     \r\n&lt;\/head&gt;\r\n &lt;body&gt;    \r\n &lt;h1&gt;Membership Form&lt;\/h1&gt;\r\n    &lt;p&gt;Thanks for choosing to join The Programming Language Club.&lt;\/p&gt;\r\n    &lt;form action=index.php method=post&gt;   \r\n\t&lt;div style=\"width: 30em;\" &gt;\r\n        &lt;label for=firstName&gt;First name&lt;\/label&gt;&lt;br&gt;        &lt;input type=text name=firstName id=firstName required \/&gt;&lt;br&gt;&lt;br&gt;\r\n        &lt;label for=lastName&gt;Last name&lt;\/label&gt; &lt;br&gt;       &lt;input type=text name=lastName id=lastName  required\/&gt;&lt;br&gt;&lt;br&gt;\r\n        &lt;label for=password1&gt;Choose a password&lt;\/label&gt; &lt;br&gt;       &lt;input type=password name=password1 id=password1 required \/&gt; &lt;br&gt;  &lt;br&gt;  \r\n\t\t&lt;label for=password2&gt;Retype password&lt;\/label&gt;&lt;br&gt;        &lt;input type=password name=password2 id=password2 required \/&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=genderMale&gt;Are you male...&lt;\/label&gt;        &lt;input type=radio name=gender id=genderMale value=Male \/&gt;       \r\n\t\t&lt;label for=genderFemale&gt;...or female?&lt;\/label&gt; &lt;input type=radio name=gender id=genderFemale value=Female checked \/&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=favoriteWidget&gt;What's your favorite language?&lt;\/label&gt;        &lt;select name=favoriteWidget id=favoriteWidget size=1&gt;        \r\n\t\t&lt;option value=java&gt;Java&lt;\/option&gt;     \r\n\t\t&lt;option value=php&gt;PHP&lt;\/option&gt;          \r\n\t\t&lt;option value=phyton&gt;PHYTON&lt;\/option&gt;     \r\n\t\t&lt;\/select&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=newsletter&gt;Do you want to receive our newsletter?&lt;\/label&gt;        \r\n\t\t&lt;input type=checkbox name=newsletter id=newsletter value=yes \/&gt; &lt;br&gt; &lt;br&gt;\r\n        &lt;label for=comments&gt;Any comments?&lt;\/label&gt;       \r\n\t\t&lt;textarea name=comments id=comments rows=4 cols=50&gt; &lt;\/textarea&gt;\r\n        &lt;div style=\u201dclear: both;\u201d&gt;         \r\n\t&lt;input type=submit name=submitButton id=submitButton value=Send Details \/&gt;       \r\n\t&lt;input type=reset name=resetButton id=resetButton value=\"Reset Form\" style=\"margin-right: 20px;\" \/&gt;      \r\n\t&lt;\/div&gt;     \r\n\t&lt;\/div&gt;   \r\n\t&lt;\/form&gt;\r\n  &lt;\/body&gt; &lt;\/html&gt;\r\n\r\n<\/pre>\n<p>The form data is sent using the POST method, so the script extracts the form field value from the<code> $_POST<\/code> associative array and displays each field using PHP method<code>echo()<\/code>. The script above is used just as an example, in the real world you shouldn&#8217;t display the password the user has just entered.<br \/>\nIt is considered bad practise to trust user input without validating it. So you shouldn&#8217;t pass the values in <code>$_GET<\/code> and <code>$_POST<\/code> directly to <code>echo<\/code> or <code>print<\/code> for display in a webpage. A malicious user might be trying to break into the site, it is quite easy for a malicious user to submit form data to an unprotected site that could be used to gain access to other users credentials.<\/p>\n<h2>2. Summary<\/h2>\n<p>In this example we learnt about html forms, what they are and how to create them. We also learnt how to handle them in PHP.<\/p>\n<h2>3. Download The Source Code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <strong><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/09\/phpformactionexample-1.zip\">phpformactionexample<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user&#8217;s send data to a server or website. If a website needs to collect a user name, age or date of birth it&#8217;s most likely going to use HTML forms. Login &hellip;<\/p>\n","protected":false},"author":164,"featured_media":930,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-14574","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PHP Form Action Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user&#039;s send data to a\" \/>\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.webcodegeeks.com\/php\/php-form-action-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP Form Action Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user&#039;s send data to a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-08T13:15:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-09T08:29:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Olayemi Odunayo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Olayemi Odunayo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/\"},\"author\":{\"name\":\"Olayemi Odunayo\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8\"},\"headline\":\"PHP Form Action Example\",\"datePublished\":\"2016-09-08T13:15:00+00:00\",\"dateModified\":\"2018-01-09T08:29:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/\"},\"wordCount\":641,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg\",\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/\",\"name\":\"PHP Form Action Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg\",\"datePublished\":\"2016-09-08T13:15:00+00:00\",\"dateModified\":\"2018-01-09T08:29:56+00:00\",\"description\":\"In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user's send data to a\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/php\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP Form Action Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8\",\"name\":\"Olayemi Odunayo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g\",\"caption\":\"Olayemi Odunayo\"},\"description\":\"I am a programmer and web developer, who has experience in developing websites and writing desktop and mobile applications. I have worked with both schematic and schemaless databases. I am also familiar with third party API and working with cloud servers. I do programming on the client side with Java, JavaScript, html, Ajax and CSS while I use PHP for server side programming.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/olayemi-odunayo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP Form Action Example - Web Code Geeks - 2026","description":"In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user's send data to a","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.webcodegeeks.com\/php\/php-form-action-example\/","og_locale":"en_US","og_type":"article","og_title":"PHP Form Action Example - Web Code Geeks - 2026","og_description":"In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user's send data to a","og_url":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2016-09-08T13:15:00+00:00","article_modified_time":"2018-01-09T08:29:56+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg","type":"image\/jpeg"}],"author":"Olayemi Odunayo","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Olayemi Odunayo","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/"},"author":{"name":"Olayemi Odunayo","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8"},"headline":"PHP Form Action Example","datePublished":"2016-09-08T13:15:00+00:00","dateModified":"2018-01-09T08:29:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/"},"wordCount":641,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg","articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/","url":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/","name":"PHP Form Action Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg","datePublished":"2016-09-08T13:15:00+00:00","dateModified":"2018-01-09T08:29:56+00:00","description":"In this example we will learn how to create HTML forms and how to handle data transmitted through them with PHP. HTML forms allows user's send data to a","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/php-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/php\/php-form-action-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"PHP","item":"https:\/\/www.webcodegeeks.com\/category\/php\/"},{"@type":"ListItem","position":3,"name":"PHP Form Action Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8","name":"Olayemi Odunayo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g","caption":"Olayemi Odunayo"},"description":"I am a programmer and web developer, who has experience in developing websites and writing desktop and mobile applications. I have worked with both schematic and schemaless databases. I am also familiar with third party API and working with cloud servers. I do programming on the client side with Java, JavaScript, html, Ajax and CSS while I use PHP for server side programming.","sameAs":["https:\/\/www.webcodegeeks.com\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/olayemi-odunayo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/14574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/164"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=14574"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/14574\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/930"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=14574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=14574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=14574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}