-
Notifications
You must be signed in to change notification settings - Fork 0
/
production.php
43 lines (40 loc) · 1.26 KB
/
production.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
$categories = array(
"T-shirt"=>array(
"t001","t002","t003"
),
"Pant"=>array(
"p001","p002","p003"
)
);
if (isset($_POST['submit'])) {
if (empty($_POST['category'])) {
echo "Please select one!";
}else{
foreach ($categories as $product => $product_array) {
foreach ($product_array as $items) {
if ($_POST['category']==$items) {
echo $items;
}
}
}
}
}
?>
<form class="" action="<?php PHP_SELF?>" method="post">
<select class="" name="category">
<option value="<?php echo $categories["T-shirt"][0]?>"><?php echo $categories["T-shirt"][0];?></option>
<option value="<?php echo $categories["T-shirt"][1]?>"><?php echo $categories["T-shirt"][1];?></option>
<option value="<?php echo $categories["T-shirt"][2]?>"><?php echo $categories["T-shirt"][2];?></option>
</select>
<input type="submit" name="submit" value="Calculate">
</form>
</body>
</html>