how do i convert this

    <label for="category">Select Winner</label> <select name="willwin" id="willwin"> <?php
if ($db->numrows() > 0){
        while ($row = $db->fetch()) { ?> <option value=''></option> <option value="<?php echo $row["willwin"]; ?>"><?php echo $row["team1"]; ?></option> <option value="<?php echo $row["willlose"]; ?>"><?php echo $row["team2"]; ?></option> <?php 
}
}
?> </select> <br/><br/> <label>Tag Bettor</label> <select name="sub_cat" id="sub_cat"></select>

into this

$TPL_team_list = '<select name="willwin" class="form-control">' . "\n";
        while ($row = $db->fetch())
        {
            $TPL_team_list .= "\t" . '
            <option value="' . $row[''] . '" ' . $selected . '>' . $row[''] . '</option> <option value="' . $row['team1'] . '" ' . $selected . '>' . $row['team1'] . '</option> <option value="' . $row['team2'] . '" ' . $selected . '>' . $row['team2'] . '</option>
            ' . "\n";
        }

        $TPL_team_list .= '</select>' . "\n";

cause i need this php form to work inside tpl file

As I was unaware what TPL is or could be I read https://en.wikipedia.org/wiki/TPL_Tables and came away not much wizer.

Don't assume that all can guess what TPL is here. I googled, TPL and didn't find any language that looked like your second code passage.

Before your next reply, read https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

I think TPL stands for template file. I had to work in the past on an OpenCart webshop and that whole thing was build with.tpl files, but it was just PHP & HTML inside of these files.

commented: Here's hoping David can fill in the blanks. +12

yeah tpl is a template that doesnt seem to allow direct php codes in it

David, fill in the blanks about what language or system uses those tpl files. As it is, we're guessing. How about a link to the product page and docs? A lot of us write in many languages but we need a little more from you on this.

Member Avatar for diafol

You allow server to use php within tpl, e.g. Apache

AddType application/x-httpd-php .tpl

Or you can use templating shortcuts within tpl files, e.g. Smarty, RainTPL, etc, etc.

tpl is a template that can be connected to php to act as its frontend display

Member Avatar for diafol

Typically the files are used by templating engines or you can use native templating but seems a bit of a phaff if you're going native. Why not just give them a php extension?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.