'How can I use tags inside of a function?

I'm trying to use a tag inside of a function. In this case I want to click the button "find" and display the message "You selected the FIND option!" but it doesn't works. Can someone give me a hint or help me? I'm new using PHP. MORE DESCRIPTION: The website shows me the submit buttons "fruit" and "vegetable". When I click the fruit button then the website displays a table with products and one button called "find". If the user clicks the "find" button then the website must display the message "You selected the FIND option"(this message is just for testing). The problem here is when I click the "find" button, the website doesn't display the message.

<form action="Supermarket.php" method="post">
        Please choose which one are you looking for:
        <input type="submit" name='fruit' value="fruit">
        <input type="submit" name='vegetable' value="vegetable">
    </form>

    <?php
    if(isset($_POST['fruit'])){
        fruitMenu();
    }
    if(isset($_POST['vegetable'])){
        vegetableMenu();
    }

    function fruitMenu(){
        echo "--------Welcome to fruit section--------";
        $fruits = array(array('Name'=>"Apple",'ID'=>1234),
                        array('Name'=>"Banana",'ID'=>5678),
                        array('Name'=>"Watermelon",'ID'=>91011),
                        array('Name'=>"Orange",'ID'=>1213),
                        array('Name'=>"Mandarina",'ID'=>1415),
                        array('Name'=>"Pera",'ID'=>1617));
        displayTable($fruits);
        echo "<h2>WHAT DO YOU WANT TO DO?</h2>";
        displayOptions();
    }
?>

    <?php
        function displayOptions(){
            echo '<form action="Supermarket.php" method="post">
             <input type="submit" name="find" value="find">
             </form>';
             if(isset($_POST['find'])){
                echo "You selected the FIND option!";
            }
        }
    ?>
php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source