thank you so much for your help!!! I made change for my survey html page. Can you please give me an advice for other two pages?? thank you!!
here is my submit survey page
<!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">
<head>
<title>Survey Form</title>
</head>
<body>
<?php
if(empty($_GET["date"]) || empty($_GET["flight"]) || empty($_GET["time"]))
echo "<p>You must enter the date, flight number and departure time! Click your browser's Back button to return to the form.</p>";
else{
$DBConnect = @mysql_connect("localhost", "root", "mgs314");
if($DBConnect === FALSE)
echo "<p>Unable to connect to the database server.</p>"
. "<p>Error code ".mysql_errno()
. ": ".mysql_error()."</p>";
else {
$DBName = "airlineSurvey";
if(!@mysql_select_db($DBName, $DBConnect)){
$SQLstring = "CREATE DATABASE $DBName";
$QueryResult = @mysql_querry($SQLstring, $DBConnect);
if($QueryResult === FALSE)
echo "<p>Unable to execute the query.</p>"
. "<p>Error code ".mysql_errno($DBConnect)
. ": ".mysql_error($DBConnect)
."</p>";
else
echo "<p>You are the first visitor!</p>";
}
mysql_select_db($DBName, $DBConnect);
$TableName = "airlineSurvey";
$SQLstring = "SHOW TABLES LIKE '$TableName'";
$QueryResult = @mysql_query($SQLstring, $DBConnect);
if(mysql_num_rows($QueryResult) == 0){
$SQLstring = "CREATE TABLE $TableName
(countID SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
last_name VARCHAR(40), first_name VARCHAR(40))";
$QueryResult = @mysql_query($SQLstring, $DBConnect);
if($QueryResult === FALSE)
echo "<p>Unable to create the table.</p>"
. "<p>Error code ".mysql_errno($DBConnect)
. ": ".mysql_error($DBConnect)
."</p>";
}
$Date=stripslashes($_GET["date"]);
$FlightNumber=($_GET["flight"]);
$DepartureTime=($_GET["time"]);
$Friendliness=($_GET["friendliness"]);
$Cleanliness=($_GET["cleanliness"]);
$Space=($_GET["space"]);
$Noise=($_GET["noise"]);
$Comfort=($_GET["comfort"]);
$QueryResult = @mysql_query($SQLstring, $DBConnect);
if($QueryResult === FALSE)
echo "<p>Unable to execute the query.</p>"
. "<p>Error code ".mysql_errno($DBConnect)
. ": ".mysql_error($DBConnect)
."</p>";
else
echo "<p>Thank you for completing our survey!</p>";
}
mysql_close($DBConnect);
}
?>
</body>
</html>
Showpastresults page
<!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">
<head>
<title>Past Survey Results</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$DBConnect = @mysqli_connect("localhost", "root", "mgs314")
if($DBConnect === FALSE) {
echo "<p>Unable to connect to the database server.</p>"
. "<p>Error code ".mysql_errno()
. ": ". mysql_error()."</p>";
else {
$DBName = "airlineSurvey";
if (!@mysqli_select_db($DBConnect, $DBName))
die("<p>There are no past surveys!</p>");
$TableName = "t_survey";
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysqli_query($DBConnect, $SQLstring);
if (mysql_num_rows($QueryResult) == 0)
echo"<p>There are no passengers!</p>";
else{
echo "<p>The following passengers have completed the survey:</p>";
echo "<table width='100%' border='1'>";
echo "<tr><th>Passenger Name</th></tr>";
$Row = mysqli_fetch_assoc($QueryResult);
do {
echo "<tr><td>{$Row['psngr_name']}</td></tr>";
$Row = mysqli_fetch_assoc($QueryResult);
} while ($Row);
$TableName = "t_options";
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysqli_query($DBConnect, $SQLstring);
if (mysqli_num_rows($QueryResult) == 0)
echo"<p>There are no survey results!</p>";
echo "<p>Survey Results:</p>";
echo "<table width='100%' border='1'>";
echo "<tr><th>Friendliness of customer staff</th><th>Space for luggage storage</th><th>Comfort of seating</th><th>Cleanliness of aircraft</th><th>Noise level of aircraft</th></tr>";
$Row = mysqli_fetch_assoc($QueryResult);
do {
echo "<tr><td>{$Row['no_op']}</td>";
echo "<td>{$Row['poor']}</td>";
echo "<td>{$Row['fair']}</td>";
echo "<td>{$Row['good']}</td>";
echo "<td>{$Row['exc']}</td></tr>";
$Row = mysqli_fetch_assoc($QueryResult);
} while ($Row);
mysql_free_result($QueryResult);
mysql_close($DBConnect);
?>
</body>
</html>