There are 4 files: index.php (main), form_login.php (form with verification of login and password), reg.php (new page in which registr.php file is connected), registr.php (registration form with verification of parameters) . Please tell me how to merge all these files? For example, how to process a link so that when you click on it, the registration form loads in the same window? Here is the link code

<FORM method="POST" target="_self"> </A></A>Логин:<INPUT type="text" name="log">Пароль:<INPUT type="password" name="par"><INPUT type="submit" name="vhod" value="Войти"> <A href="registr.php"><FONT size="2">Регистрация</FONT></A> </FORM> 

After all, in order to load the form, you must unload the information that was before it. How to do this using PHP without using AJAX?

  • Nitsche did not understand. Does the registration form in your code open in another window? And what does it mean to merge together? And what have the link code when you have the form code written? Try to reformulate the problem, please. - Sh4dow
  • Yes, the registration form opens in a new window. The main page was taken as a frame - it was copied to a new file and a file with a registration form is loaded into it. Merge together - then what would be one big INDEX file and not a bunch of scattered files. The link here is then shown to show how when clicking on this link, the registration form appeared in the index in the index (such as onclick, only in PCP). But in order for it to appear, you must first remove the existing information from the page, and only then show the form. This is the difficulty .... - new_russian_man

2 answers 2

So you need an AJAX (asynchronous loading of part of the page content), because you described it))

In general, maybe you will need templates.

 <!-- верхняя часть сайта --> <? $task = (!empty($_GET['task'])) ? $_GET['task'] : false; if ($task == 'reg') { require 'registr.php'; // показываем форму регистрации } else if ($task == 'login') { require 'form_login.php'; // показываем форму авторизации } else { // другие действия } ?> <!-- нижняя часть сайта --> 

then links will be respectively

 <a href="index.php?task=reg">Регистрация</a> <a href="index.php?task=login">Авторизация</a> 

    Look link text I already answered in another question.