page redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
yasir_memon
Forum Commoner
Posts: 48
Joined: Tue Aug 11, 2009 12:29 am

page redirect

Post by yasir_memon »

i am sending is total php code before this i used only html code so kindly tell me where i am sending header before if condition or any white space waiting for repli

this warnig message is occuring

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\RMS\login.php:8) in C:\wamp\www\RMS\login.php on line 97


<?php
$A=$_POST["text1"];
$B=$_POST["text2"];
$conn=odbc_connect('AKTMAPP','ERP_TEST','ERP_TEST');
$sql="SELECT 1 A FROM USERS WHERE USR_NAME='$A' and PASSWORD='$B'";
$rs=odbc_exec($conn,$sql);
$count = odbc_result($rs,"A");
if($count>0)
{
header("Location: login.php");
}
else
{
echo "invalid user name or password";
}
odbc_close($conn);
?>
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: page redirect

Post by yacahuma »

This message only occurs if for any reason any characters are output before the header. Do a VIew Source on youyr browser and see if you see anything strange(like an error message). Also make sure that if you have any includes, they do not produce any characters. A common problem is when you have a file and close it with ?> but then enter a couple of empty lines.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: page redirect

Post by pickle »

Double post.

Locked.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Locked