<html>
<head>
<title> Response from faculty_ex2.php
</title>
</head>

<body>
<br />
<br />
<h1>Here is the response from the faulty_ex2.php:</h1>
<br />
<br />

<?php
if ((!$facultyName) || (!$facultyBdate) || (!$facultyExt))
{
    print("<p>You did not enter all the required data... try again!</p>\n");
}
else
{

$db = "test";
$table = "faculty";
$facultyName = trim($facultyName);

$query = "INSERT into $table VALUES('$facultyName', '$facultyBdate','$facultySubj', '$facultyGender', '$facultyExt')";

$link = mysql_connect("cslab103.cs.edinboro.edu","zimmer","mypw");
if (!$link)
{
    print( " ERROR connecting to MySQL.<br />");
    exit;
}

mysql_select_db($db); // connects to a db
$results = mysql_query($query);
$num_results = mysql_affected_rows( );
if ($results)
{
    print("<p>$num_results rows affected.</p>\n");
    print("<p>row added: $facultyName, $facultyBdate, $facultySubj, $facultyGender, $facultyExt</p>\n");
}
else
{
    print( " <p>ERROR in adding record.</p>/n");
    exit;
}

mysql_close($link);
}

?>
</body>
</html>