954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

keeping the form values after a generated error message

hello,
Im creating a registration page and i want to keep the user entered data after a generation of an error message.
form and the validations are in separate pages and validations belongs to a class.
html form


First Name
*

<--!more data-->

All methods i used are static
this is the class that handles the submition

class Handler{
	public static function register()	{
		
		if(isset($_GET['btnregister']))
			{
                        $fname=trim($_GET['txtfname']);
                        //some more codes
                        }
}


as you see im trying to access $fname but it does not work. i think there is a better way to do this.. can anyone please give me an idea?

Virangya
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

Ok... I found a way to do it.. using sessions :)

Virangya
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

yeah virangya is right, session is the solution to your problem, try this tutorial about session

http://www.w3schools.com/php/php_sessions.asp

vaultdweller123
Posting Pro
554 posts since Sep 2009
Reputation Points: 42
Solved Threads: 75
 

Yeah.. thanx... by the way.. now that i have solved it.. my "reset" button is inactive.. since the sessions will remain till being destroyed. i can use a "submit" type button and call session_destroy() to achieve it, but. i want to do something different, keeping the “reset” type button. can i do something with javascript? or is there any other way???

Virangya
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: