Jump to content

form valiation erros showing


birbal

Recommended Posts

i know how to validate and to show errors. but how can i validate any input and show the message in same page without using of php_self?i mean some page is like index.php. where we put the value when we submit it goes to check.phpin check.php it will check each input data. and it will store errors in an array. then it will send it back to the index.php using

header("location: /index.php?errordata=$errors")

in index.php page there will be a isset which will catch the $errors variable set or not. if it is set then it will show the errors.i can show up some errors(field is blank,username already exist,password is worng). but cant find how to show up specific errors of invalidated data.(which i validated using regexp)i hope i able to clarify my problem.

Link to comment
Share on other sites

ok i read that topic now and make some change in my code. thanks to jsg and fmdpanow i am catching errors in an array $errors and sending it to the other page via get.in the other page error are showing. till now all the codes are working. but it is now raising a php notice in error.log.something like this

[13-Oct-2010 15:08:56] PHP Notice:  Undefined index: dupemail in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 147[13-Oct-2010 15:08:56] PHP Notice:  Undefined index: token in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 149

catcherror.php

if(isset($_GET['error']){$catcherror=unserialize($_GET['error'])echo $catcherror['token'];echo $catcherror['nick'];echo $catcherror['dupmail'];}

now i am sending value from throwerror.php. now as the validation not the all time all error are raising and not showing. in the above case only $catcherror['nick'] has value from the throwerror.page..i think thats why the above notice is showing.1) am i mistaking anything so that notice is showing?2) i dont know about this php notice. is it harmful? will it crate any problem further?

Link to comment
Share on other sites

That means you aren't defining the "token" and "dupmail" indices of the array that you are passing through the querystring.Notices are the lowest level of error, and usually will not stop unrelated functionality from operating correctly. However, it still means something is wrong.P.S. I hope what you posted isn't really the contents of catcherror.php.

Link to comment
Share on other sites

That means you aren't defining the "token" and "dupmail" indices of the array that you are passing through the querystring.Notices are the lowest level of error, and usually will not stop unrelated functionality from operating correctly. However, it still means something is wrong.P.S. I hope what you posted isn't really the contents of catcherror.php.
no its not actual code. it is a partial instanace.btw it is working now..thanksi was echoing $error by its associative key..where some of those key was not intialized (which did not raised errors in seterror.php). i am now using foreach loop. it is not showing php notice now.thanks again! :)
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...