Iframe for action

Greetings! I used iframe to show errors from my login form, now user input is valid I want to direct the user to other page right after the form is submitted. Is it possible? thank you in advance.

If I understand you correctly, once they have logged in, you want to direct them to a new page. With my log-in, I use:

header("Location: http://www.example.com/newpage.php");

I have an if statement that checks to see if the user needs to change the password (using a temporary password). If they need a password change, I direct them to the change password page, otherwise, I send them to the logged in home page.

the above is mostly correct but you need to account for the base url if it ever changes the above code will fail.

try something more along the lines of this.

 header('Location:'.$_SERVER['SERVER_NAME'].'/yourpage.php');

like

if (username is true && password is true )
{
echo ‘welcome user’;
header(‘Location:’.$_SERVER[‘SERVER_NAME’].‘/yourpage.php’);

}
else {
echo ‘invalid pass’;
}

am i doing right?

Because you want to display the message after redirecting, then you should use it like this:

header('Location:'.$_SERVER['SERVER_NAME'].'/yourpage.php');
echo 'welcome user';

If you use it like the code below, then PHP will display “Warning: Headers already sent”.

echo 'welcome user';
header('Location:'.$_SERVER['SERVER_NAME'].'/yourpage.php');

thank you for the responses.

I tried all the suggestions, the result brings me to the desired page but it shows on my iframe, what I want is to create new window when user submitted the right input…I used iframe to show my errors in validation.

php is not capable of open new windows that is where javascript would have to come in and play.

i tried javascript,and it works… such that I’m having hesitation when to use and not to use javascript…just in case javascript console of my users is turned off they will not able to login in my application.am I right? perhaps I’m torn between the two…I keep on thinking not to use javascript since it works only for enhancing design…I’m a self taught programmer and I’m having trouble on that matter.