echo "<td colspan='4'>There were not records</td>"; echo "</tr>"; } else { for ($i = 0; $i < count($listar); $i++) { echo "<tr>\n <td>{$listar[$i]['idproducto']}</td>\n <td>{$listar[$i]['nom_pro']}</td>\n <td>{$listar[$i]['unidad_med']}</td>\n <td>{$listar[$i]['precio']}</td>\n\n <td>\n <a href='../controller/productos.controller.php?action=delete&id={$listar[$i]['id']}'><img src='../recursos/images/delete.png'></a>\n <a href='productosEdit.php?action=edit&id={$listar[$i]['id']}'><img src='../recursos/images/edit.png'></a>\n </td>\n </tr>\n\n "; } } } if (isset($_POST['submit']) && $_POST['submit'] == "Guardar") { $nom = $_POST['nom_pro']; $uni = $_POST['unidad_med']; $pre = $_POST['precio']; echo $nom; include '../model/productos.php'; $con = new Productos(); $result = $con->Nuevo($nom, $uni, $pre); if ($result > 0) { header('Location: ../views/productosList.php'); } } if (isset($_POST['submit']) && $_POST['submit'] == "Editar") { $id = $_POST['idproducto']; $nom = $_POST['nom_pro']; $uni = $_POST['unidad_med']; $pre = $_POST['precio']; include '../model/productos.php'; $con = new Productos(); $result = $con->Update($id, $cod, $uni, $pre); if ($result) { header('Location: ../views/productosList.php'); }