<?php
	require_once ('authorize1.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">

<head>
<title>Moreno Travel</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="content-type"
        content="text/html; charset=utf-8" />
</head>



<?php include 'admin_header.php'; ?>

<h1>Moreno Travel Admin Portal</h1>
<?php


require_once('connectvars.php');

	

$dbh = mysql_connect(hostname, username, password)

	or die("Unable to connect to MySQL");

mysql_select_db (dbname, $dbh);


  if (isset($_GET['press_id'])) {
    // Grab the press data from the GET
    $press_id = $_GET['press_id'];
	$press_headline = $_GET['press_headline'];
$press_date = $_GET['press_date'];
$press_source = $_GET['press_source'];
$press_details = $_GET['press_details'];
$press_pic = $_GET['press_pic'];

  }
  else if (isset($_POST['press_id'])) {
    // Grab the press data from the POST
  $press_id = $_POST['press_id'];
	$press_headline = $_POST['press_headline'];
	$press_date = $_POST['press_date'];
	$press_source = $_POST['press_source'];
$press_details = $_POST['press_details'];
$press_pic = $_POST['press_pic'];
	

 $query="UPDATE press SET press_headline='$press_headline',
press_date='$press_date',
press_source='$press_source',
press_details='$press_details',
press_pic='$press_pic'
WHERE press_id=$press_id";
$result= mysql_query($query) or die(mysql_error());

        echo "<p>The press release ".$press_headline." was successfully edited.  Click <a href=\"admin_presslist.php\">here</a> to edit another.";
    }
    else {
      echo '<p class="error">The press release was not edited.</p>';
    }
  

?>
</div>
<?php include 'footer.php'; ?>

</div>


</body>

</html>