-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.php
99 lines (70 loc) · 1.61 KB
/
types.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<html>
<head>
<?php include 'head.php'; ?>
</head>
<body>
<?php include 'topmenu.php'; ?>
<div id="wrapper">
<div id="content">
<?php include 'db.php'; ?>
<div id="typescreator">
<?php
if (isset($_POST["submit"]) && $_GET['new']=='type') {
insertType($_POST['name']);
}
if (isset($_POST["submit"]) && $_GET['new']=='subtype') {
//echo "insertSubType(".$_POST['name'].", ".$_POST['type'].");";
insertSubType($_POST['name'], $_POST['type']);
}
?>
<table>
<tr>
<td><h2>Nuevo Tipo</h2></td>
<td><h2>Nuevo Subtipo</h2></td>
</tr>
<tr>
<td>
<form action="types.php?new=type" method="post" id="newtype">
Name: <br /><input type="text" name="name"><br /><br />
<input class="btn btn-info" type="submit" value="Añadir" name="submit">
</form>
</td>
<td>
<form action="types.php?new=subtype" method="post" id="newsubtype">
Name: <br /><input type="text" name="name"><br /><br />
Type: <br />
<select name="type" form="newsubtype">
<?php
$res = allTypes();
while ($linea = mysqli_fetch_array($res)){
echo "<option value=\"".$linea['id']."\">".$linea['type']."</option>";
}
?>
</select>
<input class="btn btn-info" type="submit" value="Añadir" name="submit">
</form>
</td>
</tr>
</table>
</div>
<div id="typescontainer">
<table border="1">
<tr>
<td>Type</td>
<td>Subtype</td>
</tr>
<?php
$resulta = allTypesWithSubtypes();
while($material = mysqli_fetch_array($resulta)){
echo "<tr>
<td>".$material['type']."</td>
<td>".$material['subtype']."</td>
</tr>";
}
?>
</table>
</div>
</div>
</div>
</body>
</html>