'Description for callback', 'second_element_name' => etc...); $req = array('main_body' => 'Body Text'); //Set fields to exclude from database function. In this case we exclude "media" because we're going to make a special call for the gallery descriptions $ex = array('media', 'media_delete'); //This section won't usually change, but FYI... //Send info to server using 'db' function (this is our main database function we use for db manipulation: db(post_variable_array, id, action (i.e., add, edit, delet), exclude_from_function, required_variables) //If the table doesn't exist, this function will know that and create it for you. If a column doesn't exist, the function will create it for you. //To specify column types we name the fields using the following naming conventions: // 1. *_date [DATE] // 2. *_time [TIME] // 3. *_datetime [DATETIME] // 4. *_id [INT(1)] Integer with max 1 character (used for storing a 1 or 0) // 5. *_price, *_cost, *_gross, *_pct (percent) [DECIMAL(7,2)] // 6. *_body [LONGTEXT] Used for textarea form elements // 7. *_checkbox [LONGTEXT] Used for checkbox fields. We store checkbox values in a JSON-encoded array since empty checkboxes in a form aren't passed via $_POST // All other inputs are set to VARCHAR(255) which is 255 character column in the database that handles alphanumeric values // db Function returns an array: array(Succeed or fail(1 or 0), error, id, a(page action), array[error fields]) and we store this array in $db - no change $db = db($_POST, 1, 'edit', $ex, $req); if($db[3]) $_GET['a'] = $db[3]; // Function for updating descriptions for uploaded media - no change if($_POST['media']) mediaAdd($_POST['media']); // Function for deleting media - no change if($_POST['media_delete']) mediaDelete($_POST['media_delete'], $_POST['galleryId']); //See if the database function exists and succeeded without an error if($db && $db[0]!=0){ //Update XML sitemap with today's date include $_SERVER['DOCUMENT_ROOT'].'/fn/fn.sitemap.php'; sitemap('http://'.$_SERVER['HTTP_HOST'].str_replace(array('.php', '/admin'), '', $_SERVER['SCRIPT_NAME'])); //Store our message variable in the session $_SESSION['message'] = array($db[1], $db[0]); //Keep our db values in the session as well $_SESSION['db'] = $db; //Good, now redirect to this page without our POST or GET variables to avoid a page refresh and duplicate db entry - then stop processing the script - No change header('Location: '.str_replace('.php', '', $_SERVER['SCRIPT_NAME'])); exit; } else { //Otherwise, the db function threw an error and we can let the user try to correct their mistake - No Change $_SESSION['message'] = array($db[1], $db[0]); } } // End Post functions ##### IMPORTANT ##### //This is based on the name of THIS FILE (i.e., special_events.php) //$sqltable should be named according to this page's "link" suffix [e.g., "artists"] in fn.menuoptions_admin.php array) $sqltable = str_replace(".php", "", substr(strrchr($_SERVER['SCRIPT_NAME'], "/"), 1)); //Unique title value for this page ($defaultTitle should be named SIMILAR to this page's "text" value in fn.menuoptions_admin.php array) //Change this per page creation - following naming convention laid out in fn.menuoptions_admin.php $defaultTitle = "Weddings"; //Get message from session value - no change $message = $_SESSION['message']; // Include header file - no change include $_SERVER['DOCUMENT_ROOT'].'/assets/incl/header.php'; // Show main menu - no change fullmenu(); ?>