-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.php
More file actions
61 lines (53 loc) · 2.16 KB
/
Copy pathTest.php
File metadata and controls
61 lines (53 loc) · 2.16 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
<html>
<body>
<form name="test" method="POST">
<table>
<tr>
<th></th>
<th>book_id</th>
<th>card no</th>
<th>fname</th>
<th>lname</th>
</tr>
<?php
$conn = mysql_connect("localhost", "root", "");
if ($conn) {
mysql_select_db("library");
} else {
echo 'no such database';
}
$query_test = "select book_id2,a.card_no,fname,lname from book_loans a, borrower b"
. " where a.card_no = b.card_no ";
$result = mysql_query($query_test);
if ($result === FALSE) {
mysql_error();
} else {
while ($rows = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td><input type='radio' name='test' value='" . $rows['book_id2'] . " " . $rows['card_no'] . " " . $rows['fname'] . " " . $rows['lname'] . "'></td>";
//echo "<td><input type='radio' name='test'></td>";
echo "<td>" . $rows['book_id2'] . "</td>";
echo "<td>" . $rows['card_no'] . "</td>";
echo "<td>" . $rows['fname'] . "</td>";
echo "<td>" . $rows['lname'] . "</td>";
echo "</tr>";
}
echo "<tr>";
echo "<td><input type='submit' name='test_val' value='submit'/></td>";
echo "</tr>";
}
if ($_POST) {
if (isset($_POST['test_val'])) {
//echo "You have selected :" .$_POST['test'];
test_display();
}
}
function test_display() {
$test = explode(" ",$_POST['test']) ;
echo $test[0];
}
?>
</table>
</form>
</body>
</html>