简体   繁体   English

如何在数据库上保存“ contenteditable”

[英]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 如果您不介意,则可以在此处查看图片: 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: 我建议您不要使表的内容可编辑,而要允许用户对其进行更改,将要更新的数据放在输入字段中,然后发布到您的PHP脚本中进行保存:

<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. 但是,如果您仍然需要使用没有输入元素的表(我不知道为什么需要这样做),请使用javascript从表中提取值,然后提交给您的PHP脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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