<div class="divsearchs">
<form name="formasearchs" method="post" action="search">
<div class="inlinedb">
<?php echo $textsection1 ?>
<label for="secid" class="hlabel"><?php echo $textsection ?></label>
<select name="secid" class="forms2">
<option value="0" class="color2" selected><?php echo $textsection ?></option>
<?php
$result11 = $mysqli->query("SELECT insert_id, name, level, parent FROM sections WHERE level=1 AND lang_id=$lang AND publish='yes' ORDER BY priority");
while($row = $result11->fetch_array()) {
$secid11=$row['insert_id'];
$section11=$row['name'];
?>
<option value="<?php echo $secid11 ?>" class="color2 strong">
&raquo; <?php echo $section11 ?>
</option>
<?php 
$result12 = $mysqli->query("SELECT insert_id, name FROM sections WHERE parent=$secid11 AND lang_id=$lang AND publish='yes' ORDER BY priority");
while($row = $result12->fetch_array()) {
$secid12=$row['insert_id'];
$section12=$row['name'];

$ritems = $mysqli->query("SELECT id FROM items WHERE section_id=$secid12 AND type=2 AND publish='yes'");
$nritems11 = mysqli_num_rows($ritems);
?>
<?php if ($nritems11>0) {?><option value="<?php echo $secid12 ?>">----&raquo; <?php echo $section12 ?></option><?php } ?>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="inlinedb">
<?php echo $textcategory1 ?>
<label for="catid" class="hlabel"><?php echo $textcategory ?></label>
<select name="catid" class="forms2">
<option value="0" class="color1" selected><?php echo $textcategory ?></option>
<?php
$result11 = $mysqli->query("SELECT insert_id, name, type, level, parent FROM categories WHERE level=1 AND type=2 AND lang_id=$lang AND publish='yes' ORDER BY priority");
while($row = $result11->fetch_array()) {
$catid11=$row['insert_id'];
$category11=$row['name'];
?>
<option value="<?php echo $catid11 ?>" class="color1 strong">
&raquo; <?php echo $category11 ?>
</option>
<?php 
$result12 = $mysqli->query("SELECT insert_id, name, type FROM categories WHERE parent='$catid11' AND type=2 AND lang_id=$lang ORDER BY priority");
while($row = $result12->fetch_array()) {
$catid12=$row['insert_id'];
$category12=$row['name'];

$ritems = $mysqli->query("SELECT id FROM items WHERE category_id=$catid12 AND type=2 AND publish='yes'");
$nritems12 = mysqli_num_rows($ritems);
?>
<?php if ($nritems12>0) {?><option value="<?php echo $catid12 ?>">----&raquo; <?php echo $category12 ?></option><?php } ?>
<?php } ?>
<?php } ?>
</select>
</div>
<button type="submit" name="submitsection" class="button button2"><span class="icon fa-search-plus"></span> <?php echo $pagesearch ?></button>
</form>
</div>