我怎样才能把div数据提交给MySQL [英] How can I submit div data to MySQL

查看:101
本文介绍了我怎样才能把div数据提交给MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将div数据提交给MySQL。我不习惯JavaScript,所以我真的不知道什么发生在JavaScript部分,但我怎么能得到或输入的动作=部分和方法=部分,我可以或应该增加值=隐藏的输入

表格html代码:

I was wondering how can I submit div data to MySQL. Im not used to javascript so I dont really know whats happening on the javascript part but how can I get or input the action="" part and method="" part and can I or should I add value="" to the hidden input???

Form html code:
< input type =submitValue =Enterid =submitthis>
< / form>

<form onsubmit="document.getElementById('hidden_data').value=document.getElementById('showing_data').innerHTML;"> <input id="hidden_data" name="data" type="hidden"/> <div id="showing_data" class="commenttext" contenteditable="true"></div> <input type="submit" Value="Enter" id="submitthis"> </form>


推荐答案

使用表单标签内的隐藏字段并使用JavaScript把它放在里面的价值。您可以在 $ _ POST ['hydName'] >中获得隐藏字段。
将点击提交按钮的数据放入隐藏字段。保持你的行动和形式相同的方法需要。点击事件被触发后,它会将表单提交到其动作URL

Use the hidden field inside the form tag and use the JavaScript to put the value inside it. You can get the hidden field in the $_POST['hydName'].
Put the data on the click of the submit button into the hidden field. Keep your action and method of the form same as required. After the click event is fired, it will submit the form to its action URL

<input type="submit" onclick="document.getElememtById('hidden').value = document.getElementById('div').innerHtml;" />

这篇关于我怎样才能把div数据提交给MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆