예제 #1
0
            <!-- Main content -->
            <section class="content">
               <div class="row">
                  <div class="col-lg-3 col-xs-6">
                     <form method="post" action="callAddSubCategory.php">
                        <fieldset>
                           <legend>Add Sub-Category</legend>
                           Enter sub-category name: <input type="text" name="scat"/><br/><br/>
                           <select name="cat">
                           <!--Under category: <br/><input type="text" name="cat"/><br/><br/>-->
                              <?php 
//display category in html select element
include '../subcategory.php';
$data = [];
$subcatAction = new subcategory();
$result = $subcatAction->getCategory();
while ($row = mysqli_fetch_array($result)) {
    $data[] = $row;
}
foreach ($data as $key => $value) {
    ?>
                                 <option value="<?php 
    echo $value[0];
    ?>
">
                                    <?php 
    print_r($value[1]);
    ?>
                                 </option>
                                 <?php 
}