-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab10.php
70 lines (49 loc) · 1.79 KB
/
lab10.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<meta charset="UTF-8" />
<title>CN lab 10</title>
</head>
<body>
<h1>PHP programming, Internet-based databases</h1><br />
<?php
echo '<h3>Task CONNECTION:</h3><br />';
$username = "root";
$password = "";
$database = "lab10db";
$mysqli = new mysqli("localhost", $username, $password, $database);
$query = "SELECT * FROM People";
echo '<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td> <font face="Arial">PersonID</font> </td>
<td> <font face="Arial">LastName</font> </td>
<td> <font face="Arial">FirstName</font> </td>
<td> <font face="Arial">BirthDate</font> </td>
</tr>';
if ($result = $mysqli->query($query)) {
while ($row = $result->fetch_assoc()) {
$field1name = $row["PersonID"];
$field2name = $row["LastName"];
$field3name = $row["FirstName"];
$field4name = $row["BirthDate"];
echo '<tr>
<td>'.$field1name.'</td>
<td>'.$field2name.'</td>
<td>'.$field3name.'</td>
<td>'.$field4name.'</td>
</tr>';
}
$result->free();
}
// Please provide the solution for the Task CONNECTION here.
// Please provide the solution for the Task FORM here.
echo '<form method="post" action="process.php">
Name : <input type="text" name="first_name" placeholder="Enter Your Name" /><br />
LastName : <input type="text" name="last_name" placeholder="Enter Your LastName" /><br />
BirthDate : <input type="text" name="birth_date" placeholder="eg: YYYY-MM-DD" /><br />
PersonID : <input type="number" name="person_id" placeholder="Enter Your ID" /><br />
<input type="submit" value="Submit" />
</form>'
//process.php
?>
</body>
</html>