-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbranch.php
More file actions
64 lines (46 loc) · 1.66 KB
/
branch.php
File metadata and controls
64 lines (46 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE HTML>
<html>
<head>
<title> Using staff details </title>
</head>
<body bgcolor="white">
<h1> Select Branch information </h1>
<?php
$formtop='<form <action="<?php echo htmlentities($_SERVER[$redir]); ?>" method="post">';
$subbutton='<input type="submit" name="formSubmit" value="Submit" /></form><a href="index.html"> Back to index </a>';
$formdetail="";
$query="";
$result_id="";
$menu="";
if(isset($_POST['formSubmit'])) $query= $_POST['first'];
$conn_id = @mysql_connect ("server", "id","password")
or exit ();
mysql_select_db ("Dreamhome_km32", $conn_id);
if (!$query ){
$result_id = mysql_query ("select * from branch group by city") or exit ();
if ($result_id){
$menu=$formtop.'<select name="first">';
while ($row = mysql_fetch_array ($result_id)){
$menu.="<option value=".$row['City'].">".$row['City']."</option>";
}
$menu.=$subbutton;
mysql_free_result ($result_id);
}
}
if ($query){
$result_id = mysql_query ("select * from branch where city='" .$query."'") or exit ();
if ($result_id){
printf("<h1> Showing search results for :".$query."</h1><br>");
while ($row = mysql_fetch_array ($result_id)){
printf($row["Bno"]);
printf ("<p> ".$row["Street"]." ".$row["Area"]."</p>"."Tel No/Fax No <br>".$row["Tel_No"]." / ".$row["Fax_No"] );
$result_idb = mysql_query ("select * from staff where Bno='" .$row["Bno"]."'") or exit ();
printf("<p> "."Staff : </p>");
while ($rowb = mysql_fetch_array ($result_idb)){
printf($rowb["Position"]." ".$rowb["FName"]." ".$rowb["LName"]."<br>"); }}
mysql_free_result ($result_id);
}}
?>
<span><?php printf( $menu); ?> </span>
</body>
</html>