Registration form popup

I have a question for you guys.

I have a PHP script that uses a template system. 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). It is a simple script that displays multi page, multi question forms and it is small and one page. 20 true or false questions.

I installed also fancybox for image and iframe popups.

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".

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..

If those things are valid only then the popup.

Thanks for any answers!

Answers


you can try ajax request for this in following way:

  1. send form data using ajax request to php page. If all is correct echo a variable like $validated = 1 or something like that.

  2. in ajax success write a callback function that checks this echoed variable. If validated is 1 show your modal popup otherwise some error.

  3. on modal popup proceed with normal form submit


Need Your Help

Select first letter of input value and change it's color via CSS

html css

Is there a way to select the text input values first letter and change its color via CSS in the stylesheet?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.