动态使用函数的次数
可能的重复:
如何循环动态表单输入和插入数组
我有一个 php 脚本和一个表单。 php 脚本创建一个 xml 文件,但我需要的是有人输入一个数字,这将设置一定数量的文本框,以便有人为该 xml 文件写入数据。
所以我需要它编写 无论用户输入多少次。此外,名称必须是数字,但按 1 计数,例如:
...
谢谢
Possible Duplicate:
How to loop through dynamic form inputs and insert into an array
I have a php script and a form. The php script makes an xml file but what i need is for someone to enter a number and that would set that amount of textboxes that would be for someone to write data for that xml file.
So i need it to write <input type="text" name="a #">
however many times the user enters. Also the name needs to be a number but it counts by one ex:<input type="text" name="1"> <input type="text" name="2">...
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
现在只需在 html 中回显 $s
now just echo out $s in your html
这?
编辑:是的,数组比 input_x 好得多。更新了我的答案。
This?
Edit: yes, an array is much better than input_x. Updated my answer.
我认为你想要的是一系列表单字段。
您想要这样的内容:
这将打印五个文本框:
然后,当您引用这些框的值时,您可以这样做:
也就是说,通过使用“mybox[]”作为每个输入字段的名称,您可以创建一个文本框数组,然后您可以对其进行迭代。
I think what you want is an array of form fields.
You want something like this:
This will print five text boxes:
Then, when you reference these boxes' values, you do so like thus:
That is, by using "mybox[]" as the name of each input field, you create an array of textboxes, which you can then iterate through.