include("dbconnect.php"); $locsection_id = 1; $locname = ''; $locabstract = ''; if (isset($_GET["section_id"])) { // set section_id from url $locsection_id = $_GET['section_id']; } else if (isset($_POST["section_id"])) { // set section_id from form variable $locsection_id = $_POST['section_id']; //update the section text $update_section_text = "UPDATE tbl_sections SET abstract = '". $_POST['abstract'] ."' WHERE section_id = " .$locsection_id; /*name = '". $_POST['name'] ."',*/ $update_section = mysql_query($update_section_text); if (!$update_section) { die('Invalid query: ' . mysql_error()); } if (isset($_POST["return"])) { header( 'Location: '.$_POST["return"] ) ; } } //get section details $qry_section_text = "SELECT name, abstract FROM tbl_sections WHERE section_id = " .$locsection_id; $qry_section = mysql_query($qry_section_text); if (!$qry_section) { die('Invalid query: ' . mysql_error()); } While ($row = mysql_fetch_array($qry_section)) { $locname = $row['name']; $locabstract = $row['abstract']; } //check to see if you're logged in if (isset($_COOKIE["user"])) //set the cookie to continue for another hour setcookie("user", "Eileen", time()+3600); else //redirect to the login page header( 'Location: login.php?return=edit_section.php?section_id=' .$locsection_id ) ; ?>