<?php $form = getFormList(); function getFormList() { global $wpdb; $q = "SELECT * FROM wp_competition_table WHERE id =" . $_REQUEST['id'] . ""; $results = $wpdb->get_row($q); return $results; } ?> <div id="titlediv"> <div id="titlewrap"> <input type="text" name="my_option_name[c_title]" id="title" size="15" tabindex="1" value="<?php echo $form->c_name; ?> " autocomplete="off" /> </div> </div>
//VERIFY DELETE if (isset($_POST['fm-delete-yes'])) { global $wpdb; $index = 0; while (isset($_POST['fm-delete-id-' . $index])) { $data = "DELETE FROM wp_competition_data where parent_id ='" . $_POST['fm-delete-id-' . $index] . "'"; $items = "DELETE FROM wp_competition_items where id = '" . $_POST['fm-delete-id-' . $index] . "'"; $table = "DELETE FROM wp_competition_table WHERE id = '" . $_POST['fm-delete-id-' . $index] . "'"; $wpdb->get_results($data); $wpdb->get_results($items); $wpdb->get_results($table); $index++; } } // DISPLAY $formList = getFormList(); function getFormList() { global $wpdb; $q = "SELECT * FROM wp_competition_table WHERE id >= 0 ORDER BY id ASC"; $results = $wpdb->get_results($q); $formList = array(); foreach ($results as $row) { $formList[] = $row; } return $formList; } ?> <?php // FORM EDITOR