-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass2.php
More file actions
87 lines (78 loc) · 2.32 KB
/
Copy pathclass2.php
File metadata and controls
87 lines (78 loc) · 2.32 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<h1>Select all option from array</h1>
<select class="form-select">
<option value="">Open this select menu</option>
<?php
$items = ["black", "pink", "yellow", "orange"];
foreach ($items as $item) :
?>
<option value="<?=$item?>"><? ucfirst($item)?></option>
<?php endforeach;?>
</select>
<br><br>
<h1>HTML table data show by array</h1>
<table>
<thead>
<tr>
<th>Index</th>
<th>value</th>
</tr>
</thead>
<tbody>
<?php
$items=['one','two','three'];
foreach($items as $index => $item):
?>
<tr>
<td><?=htmlspecialchars($index + 1)?></td>
<td><?=htmlspecialchars(ucfirst($item))?></td>
</tr>
<?php endforeach ;?>
</tbody>
</table>
<br><br>
<h1>user information</h1>
<table>
<thead>
<tr>
<th>#</th>
<th>name</th>
<th>email</th>
</tr>
</thead>
<tbody>
<?php
$users = [['name'=>'john','email'=>'john@email.com'],
['name'=>'sam','email'=>'sam@gmail.com']];
foreach($users as $index => $user):
?>
<tr>
<td><?=htmlspecialchars($index + 1)?></td>
<td><?=htmlspecialchars($user['name'])?></td>
<td><?=htmlspecialchars($user['email'])?></td>
</tr>
<?php endforeach ;?>
</tbody>
</table>
<h1>user phone number</h1>
<table>
<thead>
<tr>
<th>#</th>
<th>id</th>
<th>phone number</th>
</tr>
</thead>
<tbody>
<?php
$users = [['id'=>101,'phone number'=>'9879694356'],
['id'=>102,'phone number'=>'5689898798']];
foreach($users as $index => $user):
?>
<tr>
<td><?=htmlspecialchars($index + 1)?></td>
<td><?=htmlspecialchars($user['id'])?></td>
<td><?=htmlspecialchars($user['phone number'])?></td>
</tr>
<?php endforeach ;?>
</tbody>
</table>