I must be missing something incredibly simple, but I can't see it. I have a function that generates a simple form that should be displayed several times within a table. Whenever I try to call the function with in a table cell, the form is displayed above the table for some reason.
Here's a simplified version of the code:
Php function that generates a form to be displayed multiple times
private function addTaskForm()
{
   // display add task form
   echo "<form method='post' action='#'>
           <select name='task'>
             <option value='1'>Clean</option>
             <option value='1'>Shop</option>
           </select>
           <input type='submit' name='btnSubmit'>
         </form>";
}
Table
echo "<table>
        <tr>
          <td>".addTaskForm()."</td> 
          <td>".addTaskForm()."</td>
          <td>".addTaskForm()."</td> 
          <td>".addTaskForm()."</td>
        </tr>
      </table>";
 
     
     
    