<?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></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['newsletter_id'])) {
    // Grab the newsletter data from the GET
    $newsletter_id = $_GET['newsletter_id'];
$newsletter_headline = $_GET['newsletter_headline'];
$newsletter_overview = $_GET['newsletter_overview'];
$newsletter_overviewpic = $_GET['newsletter_overviewpic'];


  }
  else if (isset($_POST['newsletter_id'])) {
    // Grab the newsletter data from the POST
  $newsletter_id = $_POST['newsletter_id'];
$newsletter_headline = $_POST['newsletter_headline'];
$newsletter_overview = $_POST['newsletter_overview'];
$newsletter_overviewpic = $_POST['newsletter_overviewpic'];

	

 $query="UPDATE newsletter SET newsletter_headline='$newsletter_headline',
newsletter_overview='$newsletter_overview',
newsletter_overviewpic='$newsletter_overviewpic'
WHERE newsletter_id=$newsletter_id";
$result= mysql_query($query) or die(mysql_error());

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

?>
</div>


</div>


</body>

</html>