Q:

PHP Code with HTML

I am creating a simple MVC site that uses CRUD. For the delete function I have a button, the code below is what I am trying to use to send the rowID to the controller to handle. 
I am having trouble in that the code doesnt print out on the screen correctly, The php code is being printed as well as the button. 
The rowID isnt being passed either and I am wondering if my approach with the php code is the correct way?
Code
<?php
$itemsDAO = new ItemsDAO();
$result=$itemsDAO->getItems();
foreach ( $result as $row )  {
    $uid = $row['id'];
    var_dump($uid);
?>
<form action="index.php" method="post">
<fieldset>
<input id='action' type='hidden' name='action' value='deleteItem' />
<p>
<div class="form-group">
    <div class="controls">
        <input type="hidden" id="fId" name="fId" value="<?php echo $uid; ?>">
        <input type="submit" class="btn btn-success" value="Delete">
    </div>
</div>
</p>
</fieldset>
 </form>

 <?php } ?>

Delete Function
    public function getItems () {
    $sqlQuery = "SELECT *";
    $sqlQuery .= " FROM items";

    $result = $this->getDbManager()->executeSelectQuery($sqlQuery );
    return $result;

}

A:

You could try a string replace in you forloop if you have one.
I think it would look something like this
foreach ( $this->model->itemList as $row ) 
            $HTMLItemList .= "<li><strong>" . $row ["title"] . ": </strong>" . $row ["price"] . "<blockquote>" . 
                $row ["description"] .  " " . str_replace("value2replace", $row['id'], $buttons) . ""  . $update . "</blockquote></li>";

And then you would change your form to the following 
<form action="index.php" method="post">
<fieldset>
    <input id='action' type='hidden' name='action' value='deleteItem' />
    <div class="form-group">
        <div class="controls">
            <input type="hidden" id="fId" name="fId"
                value="value2replace"> <input type="submit"
                class="btn btn-success" value="Delete" />
        </div>
    </div>
</fieldset>

