Home > Backend Development > PHP Tutorial > A simple method to implement thinkPHP pop-up confirmation box before deletion, thinkphp pop-up_PHP tutorial

A simple method to implement thinkPHP pop-up confirmation box before deletion, thinkphp pop-up_PHP tutorial

WBOY
Release: 2016-07-12 08:52:04
Original
777 people have browsed it

A simple implementation method for thinkPHP to pop up a confirmation box before deletion, thinkphp pops up

This article describes an example of a simple implementation method for thinkPHP to pop up a confirmation box before deletion. Share it with everyone for your reference, the details are as follows:

html part:
Copy code The code is as follows: Delete

javascript part:

<script>
function del()
{
  if(confirm("确定要删除吗?"))
  {
    return true;
  }
  else
  {
    return false;
  }
}
</script>

Copy after login

Controller part:

public function shanchu()
{
  $id=$this->_request('id');
  if($id)
  {
    $user=M('user');
    $data['id']=$id;
    $rs=$user->where($data)->delete();
    if($rs)
    {
      $this->success('删除成功!');
    }
    else
    {
      $this->error('删除失败!');
    }
  }
  else
  {
    $this->error('删除失败!');
  }
}

Copy after login

Supplement: The editor here recommends a PHP formatting and beautifying typesetting tool on this website to help you code typesetting in future PHP programming:

PHP code online formatting and beautification tool: http://tools.jb51.net/code/phpformat

Readers who are interested in more thinkPHP-related content can check out the special topics on this site: "ThinkPHP Getting Started Tutorial", "ThinkPHP Common Methods Summary", "Smarty Template Basic Tutorial" and "PHP Template Technology Summary".

I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1127889.htmlTechArticleA simple way to implement a confirmation box that pops up before thinkPHP is deleted. ThinkPHP pops up. This article describes how thinkPHP pops up a confirmation box before deleting. Simple implementation method. Share it with everyone for your reference, with...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template