This site uses cookies from Google to deliver its services, to personalize ads and to analyze traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies. Learn More

Table Edit Using Jquery Ajax Php

Table Edit Using Jquery Ajax Php Web-development (jquery) Table Edit Using Jquery Ajax Php

Table Edit using jquery ajax php
Table Edit using jquery ajax php






<?php include('db.php'); ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".edit_tr").click(function() { var ID=$(this).attr('id'); $("#first_"+ID).hide(); $("#first_input_"+ID).show(); }).change(function() { var ID=$(this).attr('id'); var first=$("#first_input_"+ID).val(); var dataString = 'id='+ ID +'&name='+first; $("#first_"+ID).html('<img src="load.gif" />'); if(first.length>0) { $.ajax({ type: "POST", url: "ajax.php", data: dataString, cache: false, success: function(html) { $("#first_"+ID).html(first); } }); } else { alert('Enter something.'); } }); $(".editbox").mouseup(function() { return false }); $(document).mouseup(function() { $(".editbox").hide(); $(".text").show(); }); }); </script> <style> body { font-family:Arial, Helvetica, sans-serif; font-size:14px; } .editbox { display:none } td { padding:7px; } .editbox { font-size:14px; width:270px; background-color:#ffffcc; border:solid 1px #000; padding:4px; } .edit_tr:hover { background:url(edit.png) right no-repeat #80C8E5; cursor:pointer; } th { font-weight:bold; text-align:left; padding:4px; } .head { background-color:#333; color:#FFFFFF } </style> <div> <table width="100%"> <tr> <th>PHP Frameworks</th> </tr> <?php $sql=mysql_query("select * from topphpframework"); $i=1; while($row=mysql_fetch_array($sql)) { $id=$row['id']; $name=$row['name']; if($i%2) { ?> <tr> <?php } else { ?> <tr> <?php } ?> <td width="50%"> <span><?php echo $name; ?></span> <input type="text" name="name" value="<?php echo $name; ?>" /> </td> </tr> <?php $i++; } ?> </table> </div> 
<?php include("db.php"); if($_POST['id']) { $id=mysql_escape_String($_POST['id']); $name=mysql_escape_String($_POST['name']); $sql = "update topphpframework set name='$name' where"; mysql_query($sql); } ?> 
<?php $mysql_hostname = "localhost"; $mysql_user = "root"; $mysql_password = "ednalan"; $mysql_database = "dbname"; $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Opps some thing went wrong"); mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong"); ?> 

0 Response to "Table Edit Using Jquery Ajax Php"

Posting Komentar

Contact

Nama

Email *

Pesan *