Jump to content

php created popup error message page


stockton

Recommended Posts

I have created a system using PHP & Javascript that works OK except that I want a neat display of error messages.

Error messages caught at the client are displayed in a Javascript alert, which is fine.

But errors caught at the server are not as well displayed and therefore I thought that I would ask if anyone has produced a "popup error message page" that would look similar to a Javascript alert but would originate at the server.

Link to comment
https://forums.phpfreaks.com/topic/59083-php-created-popup-error-message-page/
Share on other sites

I dont think you are really going to find a good way of doing this. Any sort of pop-up message to the user would have to be given by reloading the page with a particular variable defined(e.g. : yoursite.com/yourscript.php?errors=yes&errormsg=incorrect user name or password)

 

To then produce the pop up you would have to have php echo some javascript. Therefore, if the user doesn't have javascript turned on, then they wont ever see the error message.

 

As far as i can see, there will always have to be alternative error messages for people who do not have javascript turned on.

 

However, it may be that you could you ajax to test for any errors that the php script would generate(such as an incorrect username/password) and display them nicely for users with javascript.

Ok, so if javascript is definately being used, then you could use ajax to load a php script to do all the server side error checking. If there are no errors, you can submit the form to another php page(which will not need to do any error checking), to deal with the data. If there are errors, alert the user and do not submit the form.

Archived

This topic is now archived and is closed to further replies.

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