简体   繁体   English

注册表弹出

[英]Registration form popup

I have a question for you guys. 我有一个问题要问你们。

I have a PHP script that uses a template system. 我有一个使用模板系统的PHP脚本。 It has a user register page and the code to that page is something like the following (simplified): 它具有一个用户注册页面,并且该页面的代码类似于以下内容(简化):

$template->set_template(registration_page)

$username = $_POST['username']);
$pass     = $_POST['pass']);
$email    = $_POST['email']);

if( !check_to_see_if_all_valid() )
{
  exit_with_error();
}

$DB->save($username, $pass, $email);

//Login memeber
$_SESSION['member']   = $username;
$_SESSION['auth']     = true;

redirect( PATH . ("member/home/");

}

I also have a separate survey script (Mediata Survey Software). 我也有一个单独的调查脚本(Mediata Survey Software)。 It is a simple script that displays multi page, multi question forms and it is small and one page. 这是一个简单的脚本,可显示多页,多问题的表格,它很小,只有一页。 20 true or false questions. 20个对错题。

I installed also fancybox for image and iframe popups. 我还安装了用于图片和iframe弹出窗口的fancybox。

So... my question is the following. 所以...我的问题如下。 I would like it to after clicking the submit registration button, check and run check_to_see_if_all_valid(), if all is good then display a Modal fancybox window popup with the survey and then go to the "member homepage". 我希望在单击“提交注册”按钮之后,检查并运行check_to_see_if_all_valid(),如果一切都很好,则显示带有调查的Modal fancybox窗口弹出窗口,然后转到“成员主页”。

This modal window will popup and be non closeable until it is finished. 该模式窗口将弹出,并且在完成之前不可关闭。 Only then will the new user be created. 只有这样,才能创建新用户。

Also I wish check_to_see_if_all_valid() is run so that the first part ($user, $email, $pass) are valid and check to see that the username hasn't been taken, email is valid etc.. 我也希望运行check_to_see_if_all_valid()以便第一部分($ user,$ email,$ pass)有效,并检查未使用用户名,电子邮件有效等。

If those things are valid only then the popup. 如果这些内容仅有效,则弹出窗口。

Thanks for any answers! 感谢您的任何答案!

you can try ajax request for this in following way: 您可以通过以下方式尝试对此进行ajax请求:

  1. send form data using ajax request to php page. 使用ajax请求将表单数据发送到php页面。 If all is correct echo a variable like $validated = 1 or something like that. 如果一切正确,则使用$ validated = 1之类的变量。

  2. in ajax success write a callback function that checks this echoed variable. 在ajax成功中,编写一个回调函数来检查此回显变量。 If validated is 1 show your modal popup otherwise some error. 如果验证为1,则显示模式弹出窗口,否则显示一些错误。

  3. on modal popup proceed with normal form submit 在模式弹出窗口上,以常规格式提交

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

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