简体   繁体   中英

How to save 'contenteditable' on database

<tr contenteditable>
<td><center><?php echo $nama    = $isi['nama']; ?></center> </td>
<td><center><?php echo $jk  =  $isi['jk']; ?></center> </td>

I have this code, And I dunno how to save it on my database. if you guys don't mind, you can check the picture here : http://imagizer.imageshack.us/a/img673/4384/Ww9PKg.jpg

What I suggest is instead of making the table content editable, and allow users to change it, put the data that will be updated on input fields, and post to your PHP script to save:

<form action="/post.php" method="post">
<tr>
  <td><input type="text" name="nama-0" value="<?php echo $nama = $isi['nama']; ?>"></td>
  <td><input type="text" name="jk-0" value="<?php echo $jk  =  $isi['jk']; ?>"></td>
</tr>
</form>

But if you still need to use the table without the input elements (I've no idea why that'd be required) then use javascript to extract the values from table, and then submit to your PHP script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM