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

是否可以重定向到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条回答 默认 最新

相关推荐 更多相似问题