Jump to content

How to show error on the specific location


Ashish Sood

Recommended Posts

Why you need that? php errors are for developer not for your user. showing error publicaly is a kind of security flaws. you would like to consider other way. you can use custom error handling instead.

  • Like 1
Link to comment
Share on other sites

the point of getting error messages is so you as the developer can fix them so hopefully your users don't see them, not so you can tuck them away or ignore them.

Link to comment
Share on other sites

Ohh you guys got me wrong. I mean to ask that if i am using "if" condition and the condition get fail (may be user supplied invalid username & password) then i have to show a error message to user like" invalid credentials". which is always show on the top left corner of the page... But i want the error message to show where is want the page. Hope you guys understand my queries

Link to comment
Share on other sites

It is up to your CSS where and how you show the output, in this case custom errors you can encolse the error in div and set up some class or id to get it styled as you want.

Link to comment
Share on other sites

echo "<div class='error'>Invalid Credential</div>"; now in style sheet you can set style for class 'error' .error{position:.............}

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...