not solve yet. i have done many ways but the best thing is, the ids and names appear in the list. suppose no like that right. actually, i want to change this style of code (below) by creating a function to execute the sql process.
PHP Code:
<select name="dis_cat" id="dis_cat" onChange="this.form.submit();">
<option selected>Select</option>
<?php
global $ecisDB, $parent;
$parent = 0;
$sql = "SELECT diseaseCategoryId, diseaseCategoryName
FROM DiseaseCategory
WHERE diseaseCategoryClass = '$dcid'
AND diseaseCategoryParent = '$parent'
ORDER BY diseaseCategoryName";
$query = $ecisDB->query($sql) or die(mysql_error());
while($result = $ecisDB->fetch_array($query)){
if($result['diseaseCategoryId'] == $discatid){
?>
<option value="<?php echo $result['diseaseCategoryId']; ?>" selected><?php echo $result['diseaseCategoryName']; ?></option>
<?php } else { ?>
<option value="<?php echo $result['diseaseCategoryId']; ?>"><?php echo $result['diseaseCategoryName']; ?></option>
<?php } } ?>
</select>
this is my latest code while playing with array(). i tried to print_r the $result from the function.
PHP Code:
<?php print_r($ecisDiseaseCategory->loadDiseaseCategory($dcid)); ?>
output:
Array ( [0] => 1 [diseaseCategoryId] => 1 [1] => Acute upper respiratory infections [diseaseCategoryName] => Acute upper respiratory infections )
Bookmarks