duanmianhong4893 2019-07-23 06:57
浏览 56
已采纳

是否可以重定向到PHP中的函数内的另一个函数?

I am adding a delete button to certain rows of a table (not all). The table is already inside a form, so my thinking is to do a check to see if my button was clicked inside the function that the form submits to and redirect to a delete function if it was. I can't figure out if it's possible to do that or what other options there are.

I tried using a link for the delete, but that doesn't get the information across. I tried using another form, but that's a form within a form. If there is another way to do this, I'm happy to learn it.

Here is parts of the form:

echo '<form action="#/job/addorupdate" id="jobform" name="jobform" method="post" accept-charset="utf-8">';
    echo '<input type="hidden" name="id" value="228828">';
    if ($id > 0) {
        echo '<button style="color:red;border:none;font-weight:bold;cursor:pointer;" type="submit" value="' . $id . '" name="idOfRow">X</button>';
    }
    echo '</form>';

Here is the function it goes to:

public function addOrUpdate(){ // addOrUpdate a job - control
    if ($this->input->post('idOfRow')) {
        // This is where I want to do the redirect
    }
    .
    .
}
  • 写回答

2条回答 默认 最新

  • doukui2011 2019-07-23 10:12
    关注

    The solution was to replace the button with a link and use that to call the delete function.

    echo '&nbsp;<a href="' . site_url('#/deleteunrelatedcase/' . $jobid . '/' . $id) . '" style="color:red;font-weight:bold;">X</a>';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效