SQL为会话或变量分配错误?

I have created Login forms and registration forms for a website.

The form is posted for validation to checklogin.php and checksign.php, however when it finds any errors it displayes them in the separate file.

login

The following is the error message for the following validation statement

 if (!$_POST['fullname'] | !$_POST['myusername'] | !$_POST['mypassword'] | !$_POST['remypassword']) {

        die('You did not complete all of the required fields');
    }

Error

My question is: how do i show them in the same page? For instance; in a label next to the form. Thanks, any tips would be of great help. this is the website im making autosales

By structuring your code so that the order of validation can come before final processing, and if not, display the form page again

if($_SERVER['REQUEST_METHOD'] === 'POST')
{
  $valid = false;
  // perform input validations here
  if(dosomething())
  {
    $valid = true;
  }

  // if valid, perform processing here, and either show success page (or redirect)
  if($valid === true)
  {
    // SQL junk here
    include('success.php');
    exit();
  }
}

// render original form after this line

Your form post data to checklogin.php, instead of that post data to index.php and handle validation on that page.

<form class="clearfix" action="checklogin.php" method="post">

In the past, I've used a custom error handler that uses sessions to store errors, I'd recommend that.

The advantage of using sessions (within a custom error handler) to store errors is that they can easily be read and displayed in whatever view page you have. If you want to throw errors in classes, for instance, you can display them whenever you choose once they've been saved to the session. So while for this particular problem you could simply move all your code to one php file, it's probably not the best solution.

Not to mention that if your "check login" redirects back to the login page, obviously all your variable's values will not persist.