{"id":4425,"date":"2026-04-10T12:16:26","date_gmt":"2026-04-10T11:16:26","guid":{"rendered":"https:\/\/ibex.tech\/javascript\/?p=4425"},"modified":"2026-04-10T12:19:26","modified_gmt":"2026-04-10T11:19:26","slug":"create-a-runtime-form-and-post-it","status":"publish","type":"post","link":"https:\/\/ibex.tech\/javascript\/forms-javascript\/create-a-runtime-form-and-post-it","title":{"rendered":"Create a runtime form and POST it"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Javascript<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>  var Form = document.createElement('form');\n  Form.method = 'POST';\n  Form.action = window.location.href;\n\n  var Input = document.createElement('input');\n  Input.type = 'hidden';\n  Input.name = 'MyField';\n  Input.value = MyValue;\n  Form.appendChild(Input);\n\n  document.body.appendChild(Form);\n  Form.submit();<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">PHP<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>  if ( ($_SERVER&#91;'REQUEST_METHOD'] === 'POST') &amp;&amp; (isset($_POST&#91;'MyField'])) )\n  {\n    $MyField= trim($_POST&#91;'MyField']);\n\n  }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Javascript PHP<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-4425","post","type-post","status-publish","format-standard","hentry","category-forms-javascript"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/4425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/comments?post=4425"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/4425\/revisions"}],"predecessor-version":[{"id":4427,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/4425\/revisions\/4427"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/media?parent=4425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/categories?post=4425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/tags?post=4425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}