spires Posted August 23, 2006 Share Posted August 23, 2006 Hi, Can any one see why the header is not working. I'm not using any HTML before it, but its still not working?Is there any other ways around the header function?[code]$arrErrors = array();if (!empty($_POST['submit'])) { if ($_POST['username']=='') $arrErrors['username'] = 'Add Your Username'; if ($_POST['password']=='') $arrErrors['password'] = 'Add Your Password'; if (count($arrErrors) == 0) { $username=$_POST['username']; $password=$_POST['password']; $sql="SELECT * FROM user_info WHERE username='$username' and password='$password'"; $result = mysql_query($sql); $count = mysql_num_rows($result); if ($count == 1) { session_register('username'); session_register('password'); header('Location:download_item.php'); } else { $noinput = '<div class="white2">Sorry. You have entered an incorrect username or password,<br> please try again'; } } else { if (empty($username) || empty($password)) { $strError = '<div class="white2">'; foreach ($arrErrors as $error) { $strError .= "<li>$error</li>"; } $srtError .= '</div>'; } } } echo '<br> <form name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'"> <table width="185" height="102" border="0" cellspacing="0" cellpadding="0" background="JPGS/tags/members.jpg"> <tr> <td valign="middle"> <center> <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e5eaee"> <tr> <td colspan="3"> <div align="center" class="layerText">MEMBERS AREA </div> </td> </tr> <tr> <td class="small2"> Login: </td> <td colspan="2"> <div align="left"> <input name="username" type="text" size="14" id="username" value="'.$_POST['username'].'"> </div></td> </tr> <tr> <td class="small2"> Password: </td> <td colspan="2"> <div align="left"> <input name="password" type="password" size="14" id="password" value="'.$_POST['password'].'"> </div></td> </tr> <tr> <td colspan="3"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> <a href="forgot_your_password.php" class="link">Forgot your password?</a> </td> <td> <input name="submit" type="image" src="JPGS/buttons/login.jpg" value="submit"> </td> </tr> </table> </td> </tr> </table> </center> </td> </tr> </table> </form> <br>'; echo $strError; echo $noinput;[/code]RegardsJeff Link to comment https://forums.phpfreaks.com/topic/18456-can-you-see-the-problem/ Share on other sites More sharing options...
.josh Posted August 23, 2006 Share Posted August 23, 2006 what about the code above that? even a space above your <?php tag counts as html Link to comment https://forums.phpfreaks.com/topic/18456-can-you-see-the-problem/#findComment-79381 Share on other sites More sharing options...
spires Posted August 23, 2006 Author Share Posted August 23, 2006 Even a space?Thats a bit harsh.This is the very top of the page.[code]<?phpinclude('functions/wrapper1.php');include('dbconnect.php');$arrErrors = array();[/code]I cant see any spaces anywhere. Link to comment https://forums.phpfreaks.com/topic/18456-can-you-see-the-problem/#findComment-79386 Share on other sites More sharing options...
448191 Posted August 23, 2006 Share Posted August 23, 2006 No 'echoes' or 'prints' in one of those files you included?Btw, do you get an error, or does simply nothing happen. If nothing happens, and you get no errors, try:[code]header('Location: download_item.php');[/code]Yes, it's only a space, but standards and protocols can be picky.If that doesn't help, check your download_item.php. What exactly is in there anyway? Link to comment https://forums.phpfreaks.com/topic/18456-can-you-see-the-problem/#findComment-79396 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.