forked from Jmurrietasmith/EqManage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetchCategorySelect.php
More file actions
26 lines (19 loc) · 918 Bytes
/
fetchCategorySelect.php
File metadata and controls
26 lines (19 loc) · 918 Bytes
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
<?php
include('serverconnect.php');
$resultset = mysqli_query($db, "select * from EqManage.categories");
?>
<select id="cat" name="category" class="select-picker" onchange="selectOther(this.value);" style="margin-bottom: 10px">
<option value="" disabled selected>Select the category</option>
<?php
while ($row = mysqli_fetch_array($resultset)){
$category = $row['categoryName'];
$category_id = $row['id'];
echo $row[$category_id];
if (isset($_GET['selected']) && $_GET['selected'] == $category_id){
echo "<option name='category_id' value='$category_id' selected='selected'>$category</option>";
} else echo "<option name='category_id' value='$category_id' >$category</option>";
}
?>
<option value="Other">Other...</option>
<input type="text" name="other" id="other" style='display:none;' placeholder="New category name"/>
</select>