dongpo1216 2015-09-30 12:39
浏览 49
已采纳

是否可以使用PHP表单传递html元素属性?

I would like to know if I can send html elements attributes (like id, class or title) with a classic post form and save them in a db.

I know this is possible with AJAX, saving the values in variables with javascript and then sending them to a PHP file with $.post or $.ajax

But is it possible with a normal post submit form?

Thanks to all

  • 写回答

2条回答 默认 最新

  • doujianwei8217 2015-09-30 12:46
    关注

    This is not possible. Only the value- and the name-attribute are sent to the server when you use a classic submit. There is no way to get more attributes then these two. So, you are forced to use javascript.

    The following might be an alternative to your proposed $.post-function: you can adjust a form and then submit it using javascript. So, apart from the two JQuery-functions you mention, there is also a form.submit() method. You will have to manipulate the value- and name-attribute of the form-elements and then use .submit() to send those to the server.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播