I think your problem is with the <meta> tag <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <-- header
Also I'm not sure but the <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> might cause problems too Try the if statement at the top of the document. One more thing. I think that you can't add header info after <head>, but I'm not sure about this. What I usually use for redirection is something like: (a page after the LOGIN page that check for correct/incorrect logins) <?php // IF LOGIN SUCCESSFUL if ($enter == "1") { echo" <script> top.location=\"cms_home.php\" </script> "; // IF NOT (you can display HTML here instead of redirecting) } else { echo" <script> top.location=\"cms_index.php\" </script> "; } ?> I hope that helps Mario _________________________ Marios Adamantopoulos Senior Developer Tonic +44 (0)20 7691 2227 +44 (0)7970 428 372 www.tonic.co.uk Recent projects www.polydor.co.uk www.adcecreative.org www.sony-europe.com/pocketlife ............................................................................ .................................... Opinions, conclusions and other information in this message that do not relate to the official business of Tonic Design Limited shall be understood as neither given nor endorsed by them. ............................................................................ .................................... -----Original Message----- From: Denis L. Menezes [mailto:[EMAIL PROTECTED]] Sent: 16 January 2003 17:07 To: PHP general list Subject: [PHP] Redirecting - here is the code I tried. But I get an error as follows : Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/virtual2/66/175/19/84/html/maintenance.php:11) in /usr/local/www/virtual2/66/175/19/84/html/maintenance.php on line 30 My code is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFCC"> <table width="70%" border="0"> <tr> <td height="67" colspan="3" bgcolor="#330066"> <div align="center"><font color="#FFFF00" face="Arial, Helvetica, sans-serif"><strong><font size="5">Site maintenance page<?php //connecting to the database $link = mysql_connect("localhost","mydomain","somepass"); if ($link){ Print ""; } else { Print "No connection to the database"; } if (!mysql_select_db("mydomain_com")){ Print "Couldn't connect database"; } else { Print ""."<br>\n"; } $sql="SELECT AdminFirstName,AdminLoginId,AdminPassword FROM Administrators where AdminLoginId = '$AdminLoginId' and AdminPassword ='$AdminPassword'"; if ($result=mysql_query($sql)) { $numofrows=mysql_num_rows($result); if ($numofrows==0){ header("Location: http://www.php-faq.com/"); Print "<STRONG><font color=\"#FF0000\"size=\"3\">We are sorry.</STRONG></FONT>"; } if ($numofrows==1){ Print "<font size=\"3\" color=\#ff0000\">Welcome ".$AdminFirstName."<Font>"; } if ($numofrows>1){ Print "<STRONG>Something wrong</STRONG>"; } while($row=mysql_fetch_array($result)){ Print"<Font size=\"3\">$row[AdminFirstName]</font>"; } } ?></font></strong></font></div></td> </tr> </table> </body> </html> Unquote. Line no. 30 is the one with the line : header("Location: http://www.php-faq.com/"); Can you please tell me what is wrong? thanks denis