{"id":508,"date":"2011-08-22T23:04:24","date_gmt":"2011-08-23T03:04:24","guid":{"rendered":"http:\/\/cfdbplugin.com\/?page_id=508"},"modified":"2016-12-15T21:55:37","modified_gmt":"2016-12-16T02:55:37","slug":"cfdb-save-form-post","status":"publish","type":"page","link":"https:\/\/cfdbplugin.com\/?page_id=508","title":{"rendered":"[cfdb-save-form-post]"},"content":{"rendered":"<p><span style=\"color: #000000;\"><em><strong>AVAILABLE AS OF RELEASE \u00a02.1<\/strong><\/em><\/span><\/p>\n<p><em><strong>WARNING<\/strong>: Only use this short code to capture data from a form that is <span style=\"text-decoration: underline;\"><strong>NOT<\/strong><\/span> created by\u00a0<a href=\"http:\/\/wordpress.org\/extend\/plugins\/contact-form-7\/\" target=\"_blank\">Contact Form 7<\/a>\u00a0(CF7),\u00a0<a href=\"http:\/\/wordpress.org\/extend\/plugins\/si-contact-form\/\" target=\"_blank\">Fast Secure Contact Form<\/a>\u00a0(FSCF) or JetPack form. If you are using one of those, then this plugin will automatically capture the form submissions. This short code is for special cases.<\/em><\/p>\n<p>This plugin was written to capture data from <a href=\"http:\/\/wordpress.org\/extend\/plugins\/contact-form-7\/\" target=\"_blank\">Contact Form 7<\/a> (CF7), \u00a0<a href=\"http:\/\/wordpress.org\/extend\/plugins\/si-contact-form\/\" target=\"_blank\">Fast Secure Contact Form<\/a> (FSCF) and JetPack forms but what if you don&#8217;t want to use them? What if you want to put an old-fashion HTML FORM tag in your post or page and have it submit to a post or page where the data will be put in the database? You may want to do this if you are trying to do some fancy things on the form&#8217;s target page that you just can&#8217;t do with CF7 or FSCF.<\/p>\n<p>In that case you can use this shortcode on the page that a form posts to to make it save the submission data to the database. This short code does not generate any output on the page where it is placed.<\/p>\n<p>How to do this:<\/p>\n<p><strong>First<\/strong>: Create a form on a page or post. Example<\/p>\n<pre>&lt;form action=\"\" <span style=\"color: #ff0000;\">method=\"post\"<\/span> enctype=\"multipart\/form-data\"&gt;\r\n   &lt;input type=\"hidden\" <span style=\"color: #ff0000;\">name=\"form_title\" value=\"People\"<\/span>\/&gt;\r\n   First Name: &lt;input type=\"text\" name=\"fname\" value=\"\"\/&gt;&lt;br\/&gt;\r\n   Last Name: &lt;input type=\"text\" name=\"lname\" value=\"\"\/&gt;&lt;br\/&gt;\r\n   &lt;input type=\"file\" name=\"upload\"\/&gt; &lt;br\/&gt;\r\n   &lt;input type=\"submit\" \/&gt;\r\n&lt;\/form&gt;<\/pre>\n<ol>\n<li>\u00a0In this example, action=&#8221;&#8221; making the form post to the same page. You can make it the same or a different page as you like.<\/li>\n<li>You must use <span style=\"color: #ff0000;\">method=&#8221;post&#8221;<\/span> and not method=&#8221;get&#8221;<\/li>\n<li>Give the form a hidden field named &#8220;<span style=\"color: #ff0000;\">form_title<\/span>&#8221; . This will be used to give the form a name in the database. If not given, the name &#8216;Untitled&#8217; is used.<\/li>\n<li>Do NOT name any input fields as &#8220;name&#8221; like this: &lt;input type=&#8221;text&#8221; name=&#8221;name&#8221;\/&gt; because WordPress uses &#8220;name&#8221; and you will navigate to a WordPress error page.<\/li>\n<\/ol>\n<p><strong>Second<\/strong>, somewhere on the page where this form posts (action page) simply put the short code:<\/p>\n<pre>[cfdb-save-form-post]<\/pre>\n<ol>\n<li>The short code will save the data to the database<\/li>\n<li>No page output is generated (but you may get an extra new line if you have the short code on its own line, WordPress can inject a new line)<\/li>\n<\/ol>\n<div><strong>Warning:\u00a0No spam protection!<\/strong><\/div>\n<div>This method does not have any spam protection (like CF7 and FSCF do). Be ware that anyone that can access the action page can post any data. They can spam your database.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>AVAILABLE AS OF RELEASE \u00a02.1 WARNING: Only use this short code to capture data from a form that is NOT created by\u00a0Contact Form 7\u00a0(CF7),\u00a0Fast Secure Contact Form\u00a0(FSCF) or JetPack form. If you are using one of those, then this plugin will automatically capture the form submissions. This short code is for special cases. This plugin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1577,"menu_order":8,"comment_status":"closed","ping_status":"closed","template":"page-without-sidebar.php","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-508","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1mptf-8c","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=508"}],"version-history":[{"count":12,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/508\/revisions"}],"predecessor-version":[{"id":1241,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/508\/revisions\/1241"}],"up":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1577"}],"wp:attachment":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}