forked from Blackbeard978/laravel_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiple_CheckBoxes.php
42 lines (35 loc) · 1014 Bytes
/
multiple_CheckBoxes.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
<?php
// Get the value of name field
// from $_POST array
$name = $_POST['name'];
// Get the value of contact field
// from $_POST array
$contact = $_POST['contact'];
// Get the value of email field
// from $_POST array
$email = $_POST['email'];
// Check if at least one skill has been checked, if
// checked, then assign the array returned by
// $_POST['skills'] to $skills variable otherwise
// assign an empty array
$skills = (isset($_POST['skills'])) ? $_POST['skills'] : array();
?>
<h2>Confirmation</h2>
<p><strong>Name :</strong> <?php echo $name; ?></p>
<p><strong>Email :</strong> <?php echo $email; ?></p>
<p><strong>Contact :</strong> <?php echo $contact; ?></p>
<p><strong>Skills :</strong>
<?php
// Check if $skills array has at least one
// element, if so, then iterate through
// each element and echo its value, otherwise
// echo that no skill is selected
if (count($skills) > 0) {
foreach ($skills as $skill) {
echo $skill .' ';
}
} else {
echo "No skill has been selected";
}
?>
</p>