<?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>Edit Itinerary</h1>

<i><font color="#C11B17" size="0.5px">Click <a href="admin_additinerary.php" target="blank">here</a> to add a new itinerary.</i></font><br><br>

<p> Please edit as required.<br><br></p>
<?php
$package_id=$_GET['package_id']; 
$itinerary_id=$_GET['itinerary_id']; 
require_once('connectvars.php');

$dbh = mysql_connect(hostname, username, password)

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

mysql_select_db (dbname, $dbh);

// run the query and put the results in an array variable called $result
$result = mysql_query("SELECT * FROM itinerary WHERE package_id = $package_id ORDER BY day ASC");

// start a counter in order to number the input fields for each record
$i = 0;

// open a form
print "<form name='edititinerary' method='post' action='admin_editinscript.php'>\n";

// start a loop to print all of the courses with their book information
// the mysql_fetch_array function puts each record into an array. each time it is called, it moves the array counter up until there are no more records left
while ($itinerary = mysql_fetch_array($result)) {

// assuming you have three important columns (the index (itinerary_id_id), the course name (day), and the book info (headline))
  // start displaying the info; the most important part is to make the name an array (notice headline[$i])
  print "<input type='hidden' name='itinerary_id[$i]' value='{$itinerary['itinerary_id']}' />";
  print "<strong>Day:</strong> <input type='text' size='5' name='day[$i]' value='{$itinerary['day']}' />";
  print "<strong>Headline:</strong> <input type='text' size='40' name='headline[$i]' value='{$itinerary['headline']}' /><br>";
  print "<strong>Breakfast is held:</strong> <input type='text' size='40' name='breakfast[$i]' value='{$itinerary['breakfast']}' /><br>";
  print "<strong>Lunch is held:</strong> <input type='text' size='40' name='lunch[$i]' value='{$itinerary['lunch']}' /><br>";
  print "<strong>Dinner is held:</strong> <input type='text' size='40' name='dinner[$i]' value='{$itinerary['dinner']}' /><br>";
  print "<strong>Overnight, enjoy a good night's rest at:</strong> <input type='text' size='40' name='overnight[$i]' value='{$itinerary['overnight']}' /><br>";
  print "<strong>Details:</strong><br> <textarea cols='110' rows='10' name='details[$i]'>{$itinerary['details']}</textarea><br><br><hr>"; 
// add 1 to the count, close the loop, close the form, and the mysql connection
++$i;
}
print "<br><input type='submit' value='submit' />";
print "</form>";
mysql_close();
?>





</ul><br><br><br>
</div>


</div>

</body>

</html>