【问题标题】:How to post form value with span tag in php?如何在php中使用span标签发布表单值?
【发布时间】:2016-02-08 23:59:11
【问题描述】:

我有一个表单,其中有许多跨度元素,每个跨度元素都有自己的 id 我的跨度标签现在作为表单的输入文本字段我想将跨度字段值发送到我的 php 文件以插入我的db 就像在 php $_POST['fname'] 中一样,如果我们使用输入类型文本,我们可以获得这个值,但如果它是一个跨度怎么做?

我的代码是:

<form action="form_submit1" method="POST">
   <div class="form-group">
        <span class= "sexyform" id="6" name="fname" data-placeholder="Enter Your First Name"></span>
        </div>
</form>

【问题讨论】:

  • 你可以使用 ajax 来做到这一点..
  • 使用&lt;span&gt;有什么具体原因吗?
  • 是的,我的表单样式类似于 Google 表单输入文本中的样式

标签: php html css


【解决方案1】:

你使用 ajax

$(document).on("click", ".sexyform", function () {
   var id=$(this).attr('id');
   $.ajax({
    type: 'POST',
    url: "form_submit1",
    data:{fname:id},
    success: function (result) {
       your action after success
     },
  })
})

【讨论】:

  • 不工作请帮忙有什么办法可以用php做吗?
猜你喜欢
  • 2016-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多