php 网站的架构帮助
我正在帮助用 PHP 制作一个网站,这是一个 ERP 目的网站。我们制作了一个表单模型来收集用户详细信息,该表单被分成 4 个 Facebook 风格的屏幕,最终用户在填写每个部分表单后不断点击“下一步”。最后他们得到预览并生成确认收据。 我应该如何在后端处理这个问题,我确信在预览之后我会将这些值写入 Mysql 数据库并生成收据。我的问题是如何在预览之前存储这些值?
I am helping to make a website in PHP which is an ERP purpose website. We made mockups of a form to collect user details which is split into 4 screens facebook style where the end user keeps clicking next after filling in each partial form. Finally they get the preview and confirmation receipt is generated.
How should I go about this in the backend, I am sure that after the preview I will write the values to the Mysql db and generate a receipt. My question is how do I go about storing the values before the preview?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用 php 会话将变量存储在会话中,然后最后将它们全部存储在数据库中。
http://php.net/manual/en/features.sessions.php
you can use php sessions to store the variables in a session and then at the end store them all in the database.
http://php.net/manual/en/features.sessions.php
你无法真正孤立地回答你的问题。这实际上取决于您的用户将如何使用系统,他们输入的信息是否应该持久,甚至您是否知道用户是谁?
假设您知道用户是谁,并且您想保留失败的会话,我的建议是将部分响应存储在数据库中,以便您以后可以随时访问它们。
然后,您可以根据需要填充或重新填充表单。在这种情况下,您还应该有一个“重新开始”按钮。
更多信息将有助于给出更好的答案。
You cannot really answer your question in isolation. It really depends on how your user is going to use the system, whether the information they enter should be persistent, and even whether you know who the user is?
Assuming you know who the user is, and you want to keep failed sessions, my suggestion would be to store the partial responses in a database so you can always access them later.
You can then populate or re-populate the form as you wish. You should also have a "start again" button in this scenario.
More information would help give a better answer.
您可以每个屏幕/页面只有一个表单,然后通过 post 或 get 将这些值作为参数发送到下一页 - 这是最简单的方法
You can just have one form per screen/page and send these values as parameters to the next page via post or get - it's the most simple way
还可以将所有表单标记保留在单个页面上,并使用 formToWizard jquery 插件将表单划分为步骤。
http://www.jankoatwarpspeed.com/post/2009 /09/28/webform-wizard-jquery.aspx
这样,当用户在步骤中来回单击时,用户可以获得所有可用数据,并且您可以只使用单个提交按钮。
It is also possible to keep all the form markup on single page and divide form into steps using formToWizard jquery plugin.
http://www.jankoatwarpspeed.com/post/2009/09/28/webform-wizard-jquery.aspx
This way user has all data available when users clicks and back and forth during the steps and you can just have single submit button.