function display_subcategory($subcat_id) { $category = new maincategory(); $data = $category->getsubcategory($subcat_id); if (!is_array($data)) { return false; } echo '<select name="subcategory">'; foreach ($data as $row) { echo '<option value="' . $row['id'] . '">' . $row['name'] . "</option>"; } echo '</select>'; }
<textarea name="description" id="description" style="width: 400px; height: 180px;" class="vldnoblank"><?php echo $projectdata['description']; ?> </textarea> <span class="checkStatus"></span></td> </tr> <tr> <th><label>Project Area </label></th> <td><?php $category = new maincategory(); $data = $category->getcategory(); foreach ($data as $row) { // print_r($data); echo '<input name="maincategory" id="maincategory" value="' . $row['id'] . '" type="radio"'; $subcategory = $category->getsubcategory($row['id']); if (is_array($subcategory)) { echo ' onclick="showDiv(\'subcategory\'); loadAjax(\'/ajax/project/editsubcategory.php?id=' . $row['id'] . '&selected=' . $projectdata['sub_maincategory_id'] . '\',\'div_subcategory\');" '; } else { echo ' onclick="hideDiv(\'subcategory\');" '; } if ($projectdata['maincategory_id'] == $row['id']) { echo "checked='checked'"; } // if(strtoupper($row['name'])=="USA") echo '" checked="checked"'; // echo '> '.$row['name']." "; echo '>' . $row['name'] . " "; } // $project = new project(); // $project->display_category(); ?>