jquery click-to-Change +php native code display

Source: Internet
Author: User

show.php code page

<meta charset= "UTF-8" &GT;&LT;?PHP//Link Database$link=Mysqli_connect(' 127.0.0.1 ', ' root ', ' root ', ' mfour ');//Set character setsMysqli_query($link, ' Set names UTF8 ');//Stitching SQL$sql= "SELECT * FROM USER";//Execution$res=Mysqli_query($link,$sql);//loop into an array while($a=Mysqli_fetch_assoc($res)){    $data[] =$a;}><table border= "1" > <tr> <th>ID</th> <th> name </th> <th&gt Password </th> <th> mobile </th> <th> address </th> </tr> <?phpforeach($data  as $kk=$v) {?> <tr id= "<?php Echo$v[' id ']?> ' > <td fd= ' id ' ><?phpEcho $v[' id ']?></td> <td fd= ' name ' ><?phpEcho $v[' Name ']?></td> <td fd= "pwd" ><?phpEcho $v[' pwd ']?></td> <td fd= ' phone ' ><?phpEcho $v[' Phone ']?></td> <td fd= ' area ' ><?phpEcho $v[' Area ']?></td> </tr> <?php}? ></table><script src= "Jquery.js" ></script>&lt ;script>//html () parentheses do not write anything is to value, write a thing is replaced//attr represents a property$ (document). Ready (function () {        //Double-click to navigate to a TD label$ ("TD"). DblClick (function () {            //get the contents of TD tags            varTd_val = $ (this).html (); //get the value of a TD property            varFd_val = $ (this). attr (' fd ')); //gets the property value of the TR            varTr_val = $ (this). Parents (). attr (' id '); //Replace$ (this). HTML ("<input type= ' text ' id= '" +td_val+fd_val+ "' value= '" +td_val+ ">"); //get the contents of a text box$ ("#" +td_val+fd_val). Blur (function () {                varNew_val = $ (this).Val (); $ (This). Parents ("TD").html (new_val); //Request$.post ("insert.php",{ID: Tr_val,//the value of the IDFd:fd_val,//the name of the fieldV:new_val//the value of the field},function(Data,status)            {                    }); })        })    });</script>

PHP processing data page: insert.php

<?PHP//Receive Value$id=$_post[' ID '];$FD=$_post[' FD '];$v=$_post[' V '];//Link Database$link=Mysqli_connect(' 127.0.0.1 ', ' root ', ' root ', ' mfour ');//Set character setsMysqli_query($link, ' Set names UTF8 ');//Stitching SQL$sql= "Update user set$FD=$v' WHERE id=$id";//ExecutionMysqli_query($link,$sql);

jquery click-to-Change +php native code display

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.