在同一页面上两个表单提交后台收不到前端提交的数据

迅睿框架 更新 2025-07-21 16:32:52 提莫

一个页面两个表单,表单建立出来之后onclick="dr_ajax_submit和<input name="csrf_test_name" type="hidden" value="*****">都一样导致能提交,但是后台接收不到数据,应该怎么办?


方案

  • 迅睿官方创始人 #1 · 2025-07-19 18:01:51
    一个页面来两个form,你的formid号不要写成一样就行了
  • 提莫 #2 · 2025-07-19 19:05:37
    formid没有写成一样的,可以提交。但是后台第二个表单收不到字段信息
  • 迅睿官方创始人 #3 · 2025-07-19 21:00:08
    浏览器开发模式看网络请求记录,看form数据有没有提交上去
  • 提莫 #4 · 2025-07-21 10:25:33
    提交上去是null
  • 小鱼儿 #5 · 2025-07-21 14:11:37
    检查一下提交按钮点击事件上面绑定的formid是不是没改,导致提交的是另一个表单
  • 提莫 #6 · 2025-07-21 14:44:02
    method="post" name="myform" id="contactus" /index.php?s=form&c=contactus&m=post点击事件和formid都写成一样的,会显示
    image
  • 小鱼儿 #7 · 2025-07-21 14:55:45
    name="myform" 这个要不一样,还有下面按钮里面传的这个值也要对应修改
  • 提莫 #8 · 2025-07-21 15:10:22
    <form method="post" name="sgyefrom" id="sgyefrom"> <button type="button" onclick="dr_ajax_submit('域名?s=form&c=sgyefrom&m=post', 'myform', '2000', '域名?s=form&c=sgyefrom&m=post')" ">

    <form method="post" name="contactus" id="contactus">

    <button type="button" onclick="dr_ajax_submit('域名?s=form&c=contactus&m=post', 'myform', '2000', '域名?s=form&c=contactus&m=post')" ">同一个页面上面,两个表单都是用的button。现在这样写都可以提交,但是在后台 name="contactus"这个表单拿不到数据。如果把上面的表单注释了,就可以拿到数据。

  • 迅睿官方创始人 #9 · 2025-07-21 15:48:00

    <form method="post" name="sgyefrom" id="sgyefrom">

    <button type="button" onclick="dr_ajax_submit('域名?s=form&c=sgyefrom&m=post', 'sgyefrom', '2000', '域名?s=form&c=sgyefrom&m=post')" ">


    <form method="post" name="contactus" id="contactus">

    <button type="button" onclick="dr_ajax_submit('域名?s=form&c=contactus&m=post', 'contactus', '2000', '域名?s=form&c=contactus&m=post')" ">

  • 提莫 #10 · 2025-07-21 16:32:52
    谢啦,这次可以了!!! 😂

迅睿系统漏洞

站群分站系统
站群分站系统(2026-10-15)
子站域名新增llms.txt访问
GEO系统
GEO系统(2026-10-14)
修复下载zip空白地址问题 修复流量复刻和任务队列错误
GeoSeo收录宝
GeoSeo收录宝(2026-10-14)
新增 站长工具箱 前端首页自动调用meta 数据
滑块验证码 Gocaptcha
滑块验证码 Gocaptcha(2026-10-13)
基于开源项目 go-captcha 的行为验证码插件,滑动拼图、区域...
GeoSeo工具箱
GeoSeo工具箱(2026-10-13)
优化巡检任务
GeoSeo排名助手
GeoSeo排名助手(2026-10-11)
加入大模型自定义
SEO聚合关键字
SEO聚合关键字(2026-10-11)
优化关键字列表页最多支持1万篇文章,过多会导致服务器扛不住;
CMS内容同步复制
CMS内容同步复制(2026-10-10)
增加时间是否更新的开关