{source}
<!-- You can place html anywhere within the source tags -->


<script language="javascript" type="text/javascript">
// You can place JavaScript like this

</script>
<?php

include $_SERVER['DOCUMENT_ROOT']."/Apps/db.php";

// Check connection

if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
// Change character set to utf8
mysqli_set_charset($con,"utf8");

$sql = "SELECT DISTINCT `facname_en` , `fid` FROM `departments` ORDER BY `fid` DESC";
$result = $con->query($sql);

if ($result->num_rows > 0) {
// output data of each row
?>
<form method="post">


<?php


echo "<select name='price' id='mySelect'>";
echo "<option selected='selected' value=0>Select Faculty</option>";
while($row = $result->fetch_assoc()) {
echo "<option value=" . $row["fid"]. ">" . $row["facname_en"]. "</option>";
}

echo "</select>
<input type='submit' value='search'>
</form>


";

} else {
echo "0 results";
}
?>
<?php
if (isset($_POST['price'])) {
$facultyid= htmlspecialchars($_POST['price']);
}
?>


<?php

$sqldep = "SELECT `dep_name_en`, `email`, `dep_url`, `facname_en` FROM `departments` WHERE `fid`=$facultyid";
$resultdep = mysqli_query($con, $sqldep);

if ($resultdep->num_rows > 0) {

// output data of each row
echo "<table border='1'>";
echo "<tr>
<td>Department</td>
<td> Department's Email </td>

<td> Department's Website </td>
<td> Faculty</td>
</tr>";
while($rowdep = $resultdep->fetch_assoc()) {

echo "<tr>
<td>" . $rowdep["dep_name_en"]. "</td>
<td>" . $rowdep["email"]. "</td>

<td><a target='_blanck' href='http://www." . $rowdep["dep_url"]. "'>" . $rowdep["dep_url"]. "</a></td>
<td>" . $rowdep["facname_en"]. "</td>
</tr>";

}

echo "</table>";
} else {
echo "0 results";
}


$con->close();
?>


{/source}