Opening another page
Posted: Tue Apr 15, 2008 11:30 pm
Hi,
I have a login page and when I submit the login form, login page reloads and include a php file "get_valid_user.php" that has the code for checking whether user exists or not.
Now when user does not exists, "get_valid_user.php" echoes the message on login page that user does not exists.
My problem is how to make "get_valid_user.php" open a new page "user_info.php" if user has supplied valid credentials?
I tried following code:
FYI, when I use "include("user_window.php");" then the content of user_window.php and content of home page overlaps.
I want to open the content of user_window.php in a separate page.
And when I use "header('Location:http://localhost/Site/user_window.php');", I get following error message:
Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/Documents/Site/home_page.php:5) in /Library/WebServer/Documents/Site/get_valid_user.php on line 40
Your help will be appreciated.
Thanks.
I have a login page and when I submit the login form, login page reloads and include a php file "get_valid_user.php" that has the code for checking whether user exists or not.
Now when user does not exists, "get_valid_user.php" echoes the message on login page that user does not exists.
My problem is how to make "get_valid_user.php" open a new page "user_info.php" if user has supplied valid credentials?
I tried following code:
Code: Select all
<?php
if($_POST["submit_form"] == "login_form_submitted")
{
if(!isset($_FILES) && isset($HTTP_POST_FILES))
{
$_FILES = $HTTP_POST_FILES;
}
$con = mysql_connect("localhost","root","xyz");
if (!$con)
{
die('Could not connect to MySQL: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$login_id = $_POST["login_id"];
$login_password = $_POST["login_password"];
$result3 = mysql_query("SELECT * FROM Company_Registration where login_id = '$login_id' && login_password = '$login_password'");
$no_Of_Row_Affected = mysql_affected_rows();
if ($no_Of_Row_Affected == 0)
{
echo "No user!!";
}
else
{
[color=#008000]//header('Location:http://localhost/Site/user_window.php');[/color]
[color=#008000]//include("user_window.php");[/color]
[color=#0000FF]I need to include a code here to open a new page user_window.php.[/color]
}
}
?>I want to open the content of user_window.php in a separate page.
And when I use "header('Location:http://localhost/Site/user_window.php');", I get following error message:
Warning: Cannot modify header information - headers already sent by (output started at /Library/WebServer/Documents/Site/home_page.php:5) in /Library/WebServer/Documents/Site/get_valid_user.php on line 40
Your help will be appreciated.
Thanks.