Jump to content

Recommended Posts

Hello,

For some time I have been wondering which one is a better means to transfer an error from a processing file back to the main page, for example a user fills in a wrong username or password at index.php which is submitted for processing to login.php. What is the best means to transfer the error "Wrong username or password" from login.php back to index.php for display, so far i was using a $_SESSION variable but i wonder how effective it can be. I was then told $_GET variables are a good choice as well, i dont think submitting a form to itself is a good solution. Please advice me on the best means to proceed with this.

 

Thanx in advance

Link to comment
https://forums.phpfreaks.com/topic/236604-error-printing-sessions-or-get/
Share on other sites

submitting to the same file is suitable if the files are short and simple but we are talking about 300+ lines of code per file. Submitting to itself will make it over 500 lines, wont this slow execution at the server? Imagine if every file is about 200KB in size

you only include the checking username and password in your case within the same file, if success do redirect, if not echo error message then you dont have to worry about the transfer the error.

 

The thing you want is that if error, you could still see the input form.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.