Simple implementation of the confirmation box popped up before thinkPHP is deleted. thinkphp pops up

Source: Internet
Author: User

Simple implementation of the confirmation box popped up before thinkPHP is deleted. thinkphp pops up

This example describes the simple implementation of the confirmation box popped up before thinkPHP is deleted. We will share this with you for your reference. The details are as follows:

Html section:
Copy codeThe Code is as follows: <a href = "_ URL _/shanchu/id/{$ vo. id}" onclick = 'Return del (); '> Delete </a>

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.jb51.net/code/phpformat

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.