且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用foreach循环更新具有相同ID的多行

更新时间:2023-12-03 13:54:16

you必须在foreach循环之间移动form标记,以便它可以提交单行数据。像这样的

you have to move your form tag between the foreach loop so that it can submit the data of single row. something like this

<?php foreach($link_data as $row) : ?>
  <form action='<?= site_url("admin/do_edit_page"); ?>' method='POST'>
    Link:<br />
    <input type='text' name='page_link_title' value='<?= $row->link_title; ?>'>
    <input type='text' name='page_link_sub_title' value='<?= $row->link; ?>'><br />
    <input type='submit' name='update_site' value='Update'>
  </form>
<?php endforeach; ?>