How to retain input textbox after submitting page?
Ok I got a really silly question to ask
This is supposed to be very simple but its not cutting it for me so here is the question.
I have a user registration form..the user enters his/her info and clicks submit.
server does some error checking..if errors are found, an error message is displayed to the user ....
now, I want to be able to retain the user's information in the input textboxes so that the input boxes do not go blank...
so how do I do this?
This is what I have:
<form name="myform" method="post" action='<?=$_SERVER['PHP_SELF'];?>'>
<input type="text" name="email" id="email" value="<?=$_POST['email'];?>"/>
This is supposed to work right? however I get an error message saying that the index 'email' is undefined.
THe other solution is to make the code ugly like this:
<input type="text" name="email" id="email" value="<? if(isset($_POST['email'])) echo $_POST['email']; ?>"/>
and I sure dont want to do it this way...its too long and ugly...
Am I missing something in the first method?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)