I creating a search option . where user input city name and see a person details who live in that city . Or user can leave blank input to see all person .
I don't see any error in this code . Checked every php validtor , I find . But this don't output anything
<?php
$find_city = $_POST['find']; //form 
//if user input nothing see all file             
if (empty($find_city))
    {
        $find_city = 'ALL';
    }
//directory open
$dirname = "gimg";
        $dirhandle = opendir($dirname);
        if($dirhandle)
        {
            $gimgs = array();
            while (false !==($file = readdir($dirhandle)))
            {
                if ($file != "." && $file != "..")
                {
                    array_push($gimgs , $file);
                }
            }
        }
        sort($gimgs);
        // I think problem in this foreach 
        foreach($gimgs as $elm)
        {
            displayPropertyInfo($elm, $find_city);
        }
    //funtion Definitions
    function displayPropertyInfo($elm, $find_city)
    {
        $img_name = 'gimg/'.$elm;
        $g_img = "<img src='".$img_name."'>";
        //filename type changing from one directory to another
        $g_info = str_replace('.jpg' , '.txt', $elm);
        $filename = 'ginfo/'.$g_info;
        $fp  = fopen($filename, 'r');
        $show_gril = 'Y';
       //search function
        while(true)
        {
            $line = fgets($fp);
            if (feof($fp))
            {
                break;
            }
            $pos = stripos($line, 'City:');
            if ($pos !== false)
            {
                $city = substr($line,5);
                $city = trim($city);
                if ($find_city != 'ALL')
                {
                    $subpos = stripos($city,$find_city);
                    if($subpos === false)
                    {
                        $show_gril = 'N';
                        break;
                    }
                }
            }
            //checking 
            $pos = stripos($line,'Name:');
            if ($pos !== false)
            {
                $name = substr($line, 5);
                $name = trim($name);
            }
            $pos = stripos($line,'Age:');
            if ($pos !== false)
            {
                $age = substr($line, 4);
                $age = trim($age);
            }
            $pos = stripos($line,'Price:');
            if ($pos !== false)
            {
                $price = substr($line, 6);
                $price = trim($price);
            }
            $pos = stripos($line,'Description:');
            if ($pos !== false)
            {
                $description = substr($line, 12);
                $description = trim(description);
            }
        }
        if($show_gril == 'Y')
        {
            print $g_img;
            print "City: ".$city."<br/>";
            print "Name: ".$name."<br/>";
            print "Age: ".$age."<br/>";
            print "Price: ".$price."<br/>";
            print "Description: ".$description."<br/>";
        }
    }
?>
 
    