{"id":958,"date":"2018-09-17T19:35:28","date_gmt":"2018-09-17T17:35:28","guid":{"rendered":"http:\/\/zogan.si\/wp\/?p=958"},"modified":"2018-09-18T13:26:08","modified_gmt":"2018-09-18T11:26:08","slug":"insert-php-2","status":"publish","type":"post","link":"https:\/\/zogan.si\/wp\/?p=958","title":{"rendered":"insert php code 2"},"content":{"rendered":"<p>[insert_php]<br \/>\n    if (!empty($_POST)) {<br \/>\n        global $wpdb;<br \/>\n        $table = bzmase;<br \/>\n        $data = array(<br \/>\n            &#8216;masa&#8217; => $_POST[&#8216;masa&#8217;],<br \/>\n            &#8216;location&#8217;    => $_POST[&#8216;location&#8217;]<br \/>\n        );<br \/>\n        $format = array(<br \/>\n            &#8216;%s&#8217;,<br \/>\n            &#8216;%s&#8217;<br \/>\n        );<br \/>\n        $success=$wpdb->insert( $table, $data, $format );<br \/>\n        if($success){<br \/>\n            echo &#8216;data has been save&#8217; ;<br \/>\n        }<br \/>\n    } else {<br \/>\n        ?><\/p>\n<form method=\"post\">\n            <input type=\"text\" name=\"location\"><br \/>\n            <input type=\"text\" name=\"masa\"><br \/>\n            <input type=\"submit\"><br \/>\n        <\/form>\n<p>        <?php \n    }  \n[\/insert_php]\n<\/p>","protected":false},"excerpt":{"rendered":"<p>[insert_php] if (!empty($_POST)) { global $wpdb; $table = bzmase; $data = array( &#8216;masa&#8217; => $_POST[&#8216;masa&#8217;], &#8216;location&#8217; => $_POST[&#8216;location&#8217;] ); $format = array( &#8216;%s&#8217;, &#8216;%s&#8217; ); $success=$wpdb->insert( $table, $data, $format );<\/p>\n<p><a href=\"https:\/\/zogan.si\/wp\/?p=958\" class=\"more-link themebutton\">Read More<\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-958","post","type-post","status-publish","format-standard","hentry","category-domaciprispevki"],"_links":{"self":[{"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=958"}],"version-history":[{"count":11,"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/958\/revisions"}],"predecessor-version":[{"id":972,"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/958\/revisions\/972"}],"wp:attachment":[{"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zogan.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}