简体   繁体   English

PHP 多步注册流程无用户名

[英]PHP multi-step registration process no username

I am working on a registration form which comprises of 2 total forms.我正在制作一个注册表,其中包含 2 个 forms。

However, I have just realised that I am unable to retrieve data from the previous form (ie: at form 2 I am unable to retrieve the Username from Step 1 when i click submit on form 2).但是,我刚刚意识到我无法从以前的表单中检索数据(即:在表单 2 中,当我单击表单 2 上的提交时,我无法从步骤 1 中检索用户名)。 Instead i only get only detail from the last page (form 2) which are:相反,我只从最后一页(表格 2)获得详细信息:

Array大批

[password] => Greatness
[fname] => John
[lname] => Winfield
[submit] => 

The array comes up like this and i dont get the username.数组像这样出现,我没有得到用户名。 I am an upcoming developer please someone help me out tell me what to do, i'd be really greatful.我是一名即将到来的开发人员,请有人帮我告诉我该怎么做,我会非常感激。

Ur extremely close.你非常接近。 All u need to do now is:你现在需要做的就是:

  1. insert the link of your form2 page in form1 action attribute.在 form1 操作属性中插入您的 form2 页面的链接。 (this sends page data from form1 page to form2 page) (这会将页面数据从 form1 页面发送到 form2 页面)

  2. define the attribute method as post or get in form1.在form1中定义属性方法为post或get。 (which makes form1 inputs accessible in form2 page via POST or GET variables using php. (这使得使用 php 可以通过 POST 或 GET 变量在 form2 页面中访问 form1 输入。

Not sure if u were wondering this too, but u can even auto-populate form2 w/ form1 inputs by embedding php w/in ur form 2 value attributes:不确定您是否也想知道这一点,但您甚至可以通过在您的表单 2 值属性中嵌入 php 来自动填充带有 form1 输入的 form2:

         ex)   <input type='text' value= "<?= $_POST['username']?>">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM