Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6203775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:58:28+00:00 2026-05-24T04:58:28+00:00

I have the following code which will check to see if the following fields

  • 0

I have the following code which will check to see if the following fields produced an error:

//Input Validations
if($user_name == '') {
    $errmsg_arr[] = 'Username missing';
    $errflag = true;
}
if($user_password == '') {
    $errmsg_arr[] = 'Username Password missing';
    $errflag = true;
}
if($insp_name == '') {
    $errmsg_arr[] = 'Inspector Name missing';
    $errflag = true;
}
if($insp_email == '') {
    $errmsg_arr[] = 'Inspector Email missing';
    $errflag = true;
}
if($confirm_password == '') {
    $errmsg_arr[] = 'Confirm Password missing';
    $errflag = true;
}       

if ($user_password != $confirm_password) { 
        $errmsg_arr[] = 'The password which you have entered do not match';
    $errflag = true;
   }

$result = mysql_query("SELECT * FROM members WHERE `email` = '$insp_email' or `login` = '$user_name' LIMIT 1" ); 
$exist = mysql_fetch_row($result); 
    if ($exist !==false ) { 
       $errmsg_arr[] = 'That email is already registered.';
       $errflag = true;
       }

//If there are input validations, redirect back to the registration form
if($errflag) {
    $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
    session_write_close();
    header("location: accountinfo.php");
    exit();
}

If an error was produced once the user is redirected back to the registration page, no error message displays. So the user has no idea why they were redirected back to the registration page. How can I get it so that once they are redirected back to the registration page, it will display an error message stating what the problem was? Ex. Username was missing, or email already registered. I want to display the error message pertaining to the error that caused them to be redirected back to the registration page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:58:28+00:00Added an answer on May 24, 2026 at 4:58 am

    The most common approach is to use flash messages. The idea is to store a flash message using session. If the message is exists in the current session, you show it’s contents and delete it (so we are sure it is a “one-time” message):

    // Register page code:

    ...
    $_SESSION['flash_message'] = 'An error has occurred on the previous page! You\'ve broken something!';
    ...
    

    After redirect:

    if (!empty($_SESSION['flash_message'])) {
        // let's show our message to a user
        echo $_SESSION['flash_message'];
        // and don't forget to erase it from session
        unset($_SESSION['flash_message']);
    }
    

    I would suggest to write your own class for this purpose, e.g.:

    FlashMessage::set('error', 'the error message itself');
    FlashMessage::get('error'); // will perform the unset
    // or
    FlashMessage::render('template', 'error'); // would render error template and show error message immediatelly if exists... etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code, which will not work. The javascript gives no errors
I have the following Java code which will search in an xml for a
I'm trying to use opengl in C#. I have following code which fails with
I have following Code Block Which I tried to optimize in the Optimized section
I have the following code which works just fine when the method is POST,
I have the following code which works fine. However, I only want to return
Okay so I have the following Code which appends a string to another in
I have the following JQuery code which does similar functionality like Stackoverflow where the
I have the following piece of code which replaces template markers such as %POST_TITLE%
I have the following JavaScript code: Link In which the function makewindows does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.