Hello byawad130,
We don't understand what you mean by "undefined index".
We don't see where you are using any indexing at all.
cerapax is trying to give you some sound programming techniques, and I don't think you understand.
Let's try to simplify this a little bit.
Here is a very simple login form that checks the username and password against values stored in a database.
When login is successful, then redirect to redirect.php.
Sample login form:
Sample redirect.php: