{"id":2158,"date":"2019-08-22T15:27:50","date_gmt":"2019-08-22T14:27:50","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=2158"},"modified":"2025-04-04T10:36:36","modified_gmt":"2025-04-04T09:36:36","slug":"submit-form-2","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/html\/forms-html\/submit\/submit-form-2","title":{"rendered":"Submit form"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Submit to same page<\/h4>\n\n\n\n<p>Simply remove the action=&#8221;&#8221; parameter and a form will be submitted to the same page.  Any URL arguments will also be retained.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  &lt;form method=\"POST\"&gt;<\/code><\/pre>\n\n\n\n<p>If you want to submit to the same page but with any previous URL arguments removed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form action=\"?\" method=\"POST\"&gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">A longer explicit way of submitting to the same page<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n  $FormSubmitUrl = $_SERVER&#91;'REQUEST_URI'];\n?&gt;\n\n  &lt;form action=\"$FormSubmitUrl\" method=\"POST\"&gt;\n\n  &lt;\/form&gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Auto Submit<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">Auto submit when selecting an item in a select box<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\n  &lt;select name=\"my_playlists\" onchange=\"this.form.submit()\"&gt;\n\n  &lt;\/select&gt;\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Auto submit form when file selected<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"file\" name=\"image_file\" multiple=\"false\" onchange=\"my_form_id.submit();\" \"&gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Checkbox auto submit on change<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  &lt;form method=\"POST\" >\n    &lt;input type=\"checkbox\" name=\"my_checkbox_name\" value=\"Yes\" onchange=\"this.form.submit();\"  \/>My label&lt;br>\n  &lt;\/form><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Submit to same page Simply remove the action=&#8221;&#8221; parameter and a form will be submitted to the same page. Any URL arguments will also be retained. If you want to submit to the same page but with any previous URL arguments removed: A longer explicit way of submitting to the same page Auto Submit Auto [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[361],"tags":[],"class_list":["post-2158","post","type-post","status-publish","format-standard","hentry","category-submit"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=2158"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2158\/revisions"}],"predecessor-version":[{"id":4812,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2158\/revisions\/4812"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=2158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=2158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=2158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}