多页面订购表格 php 或 ajax
我正在创建一个多页订购表单,第一页将包含一些下拉列表和文本字段,第二页将包含更多文本字段,第三页将是带有贝宝付款选项的订单摘要。
我只是想知道创建此订单的最佳方式是什么。我过去使用过会话,但从未让用户输入文本并从下拉列表中选择项目,有人有任何资源可以执行此操作吗?或者有谁知道我可以使用和修改的 jquery 或其他 ajax 示例或插件。
任何见解都会有很大帮助。
谢谢
I'm looking to create a multi page ordering form the first page would contain some dropdown and text fields, the second page would contain more text fields, the third page would be an order summery with paypal payment option.
I'm just wondering what the best way to create this order form is. I've used sessions in the past but never with users entering in text and picking items from drop downs, does anyone have any resources for doing this? Or does anyone know of a jquery or other ajax example or plugin I might be able to use and modify.
any insight would be a big help.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的技术可能是使用隐藏的表单字段将字段从先前的屏幕传递到最终的屏幕。
只需确保在提交最终屏幕时验证所有值,以确保用户没有篡改数据。
The simplest technique might be to use hidden form fields to carry fields from previous screens through to the final screen.
Just make sure you validate all the values when the final screen is submitted to make sure that the user hasn't twiddled the data.
如果您不愿意,则根本不需要进行分页。只需使用 css 来显示/隐藏“页面”。听起来您不必在任何时候保存“状态”。
但如果您想做多个页面,请使用会话或 cookie 来跟踪用户。然后将数据保存到数据库并将其标记为不完整。在最后一页上,检索所有内容并将其显示在页面上。服务器无法判断请求是否是ajax,因此您使用什么方式提交并不重要。
You don't need to do pagination at all if you don't won't to. Just use css to show/hide the "pages". It doesn't sound like you have to save the "state" at any point.
But if you want to do multiple pages, use a session or a cookie to track the user. Then save the data to a database a mark it as incomplete. On the final page, retrieve it all and show it on the page. The server can't tell if a request is ajax or not, so it doesn't matter what you use for submission.