$mold = new WC_Molds(); ################### ## NEW MOLD PAGE ## ################### if (isset($_POST['action']) && ($_POST['action'] == 'new' || $_POST['action'] == 'edit')) { // PAGE TITLE // ?> <h2><img style="margin-right:2px;vertical-align:bottom;" src="<?php echo bloginfo('wpurl'); ?> /wp-content/plugins/woocommerce-molds/assets/images/molds.png"> <?php if ($_POST['action'] == 'new') { echo "" . __('New mold', 'woocommerce-molds') . "</h2>"; ## We load the temporary database ## $mold->pm_load_temporary_save(); } else { if ($_POST['action'] == 'edit') { echo "" . __('Edit mold', 'woocommerce-molds') . "</h2>"; ## We load the database ## $mold->pm_load_from_db($_POST['mold_id']); } } ## This is where our form starts ## ?> <form name="moldForm" action="edit.php?post_type=product&page=woocommerce_molds" method="post" onsubmit="if((document.forms['moldForm']['mold_name'].value=='')||(document.forms['moldForm']['mold_name'].value==null)) { alert('Please enter a name.');document.forms['moldForm']['mold_name'].style.boxShadow = '0px 0px 1px 1px #FF0033';document.forms['moldForm']['mold_name'].focus(); return false;}"> <?php ## We don't forget to stay in the "new" mold page ## if ($_POST['action'] == 'new') { ?>