Tutorial: Quickfinder-Include

This include retrieves all pages with filled in “quickfinder” field and displays them in dropdown box for quick selection.

You can see, that the form target is “index.php” and a page is selected with the parameter “id”, so we don’t use any smartUrl features here, just a plain direct call.

<?php
class PhenotypeInclude_11 extends PhenotypeInclude
{
    // Quickfinder
    public $id = 11;
 
    function display()
    {
 
        global $myDB;
 
        $sql = "SELECT pag_id, pag_quickfinder FROM page WHERE pag_status = 1 AND pag_quickfinder <> '' ORDER BY pag_quickfinder";
        $rs = $myDB->query($sql);
        $options = "";
 
        while ($row = mysql_fetch_array($rs))
        {
            $options .= '<option value="'.$row["pag_id"].'">'.codeH($row["pag_quickfinder"]).'</option>';
        }
        ?>
        <form action="index.php" method="POST">
        <select name="id">
        <?php echo $options?>
        </select>
        <input type="submit" value="Go">
        </form>
        <?php
    }
}

You think Phenotype Wiki/Documentation could be better?
We too. Please contribute: Edit this page

Bookmark and Share