是否可能在HTML中有一个提交数据的按钮,同时让您删除一些数据?这里有:
...some form inputs here...
<a href="<?php echo base_url();?>index.php/report/deleteRequest/<?php echo $id; ?>" type="button" class="btn btn-default" onclick="return confirm('are you sure to reject this request?')">Reject</a>
<button type="submit" class="btn btn-primary">Accept</button>
<a href="<?php echo base_url();?>index.php/report/" type="button" class="btn btn-default">Back</a>
我希望我的接受按钮在接受请求后删除它。基本上,我需要这些来进行同步。这可能吗?如果不行,我知道还有别的办法。
提交表单并不"接受"或"删除"任何东西——它只是将数据传递给表单操作中定义的脚本。您需要在脚本中有一个函数,将数据传递给该函数,并使用所传递的数据触发该函数。如果你要发送到deleterequest。php(或。asp)它会有
If ($_POST ['addAndDelete'] == 'true')
{
//add stuff
//delete stuff
//launch a rocket
}