-
Notifications
You must be signed in to change notification settings - Fork 0
/
new.php
executable file
·47 lines (45 loc) · 1.31 KB
/
new.php
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
<?php
//connect to database, checking, etc
include "config.php";
// process form when posted
if(isset($_POST['value'])) {
if($_POST['value'] == 'branch') {
// query to get all Fitzgerald records
$query = "SELECT * FROM branch WHERE name='branch'";
}
elseif($_POST['value'] == 'semester') {
// query to get all Herring records
$query = "SELECT * FROM semester WHERE name='semester'";
} else {
// query to get all records
$query = "SELECT * FROM subjects";
}
$sql = mysqli_query($query,$db);
while ($row = mysqli_fetch_array($query,$db)){
$Id = $row["Id"];
$FirstName = $row["FirstName"];
$LastName = $row["LastName"];
// Echo your rows here...
echo 'The user ID is:' . $row['id'];
}
mysql_close($con);
}
?>
<html>
<head></head>
<body>
<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post' name='form_filter' >
<?php $sql3 = "SELECT * FROM notes ORDER BY id DESC";
$result2 = mysqli_query($db, $sql3);
?>
while ($row = mysqli_fetch_array($result2)) {
<select name="value">
<option value="all">All</option>
<option value="Fitzgerald">Fitzgerald</option>
<option value="Herring">Herring</option>
</select>
<br />
<input type='submit' value = 'Filter'>
</form>
</body>
</html>