动态添加的表单元素无法发布
我有一个表单,其中有一组被克隆的元素。该表单允许用户输入多辆车辆,并克隆多个属性(年份、品牌、型号等)。我已经成功克隆了这些元素,并且它们具有唯一的名称。但是,在发布表单后,只有非动态创建的元素才会被发布,并且可以使用 PHP 进行访问。如果您需要查看我的代码,我可以将其发布在这里,只是有点长。谢谢!
I have a form in which there are sets of elements that are cloned. The form allows a user to input multiple vehicles, with multiple attributes being cloned (year, make, model, etc). I have successfully cloned the elements and they have unique names. However, after the form is posted, only the elements that were not dynamically created get posted and are there by accessible using PHP. If you need to look at my code, I can post it on here, it's just a little lengthy. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我粗略地看了你的代码。我认为问题出在提交表格之后。元素是动态生成的。
I had a rough look at your code. I think the problem is after submission of the form. The Elements are dynamically generating properly.
我知道 OP 相当旧,但以防万一有人也遇到这个问题...将动态添加或修改的元素值发布到 PHP 的一种方法是使用 jQuery 的
serialize()
(无论如何OP似乎正在使用):I know the OP is rather old, but just in case someone is encountering this problem as well... a way to post dynamically added or modified elements' values to PHP is to use jQuery's
serialize()
(which the OP seems to be using anyway):