Simple implementation method of the confirmation box popped up before thinkPHP is deleted _ php instance

Source: Internet
Author: User
This article mainly introduces the simple implementation method of the pop-up confirmation box before thinkPHP is deleted, and analyzes the effect of the front-end HTML section of thinkPHP combined with the js control pop-up box and the deletion data processing function of the back-end controller in combination with the example, if you want to delete thinkPHP, you can refer to the following example to describe the simple implementation method of the pop-up confirmation box before thinkPHP is deleted. We will share this with you for your reference. The details are as follows:

Html section:

The Code is as follows:

Delete

Javascript section:

Script function del () {if (confirm ("are you sure you want to delete it? ") {Return true;} else {return false;} script

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 ('deleted successfully! ');} Else {$ this-> error ('deletion failed! ') ;}} Else {$ this-> error ('deletion failed! ');}}

Supplement: The editor recommends a php formatting and formatting typographical tool on this site to help you typeset code in future PHP programming:

Php code online formatting and beautification tools:Http://tools.php.net/code/phpformat

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.