ashrobbins87 Posted March 18, 2009 Share Posted March 18, 2009 My users log in to a menu page, and then choose an updater page to go to from the menu. Once they are on the updater page I cant make the menu reload, either through the browser back button or by using a link. The menu page displays a blank page and I have to refresh the browser to display it. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/ Share on other sites More sharing options...
Zane Posted March 18, 2009 Share Posted March 18, 2009 blank pages usually mean a MySQL error Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-787739 Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 I think it is obvious from the lack of responses that none of us have any idea what you are talking about. How about more detail and I don't know some code might be very useful, and seeing that this might be a work in progress a link could also be helpful in making us understand the problem. Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-787740 Share on other sites More sharing options...
drisate Posted March 18, 2009 Share Posted March 18, 2009 I think it is obvious from the lack of responses that none of us have any idea what you are talking about. How about more detail and I don't know some code might be very useful, and seeing that this might be a work in progress a link could also be helpful in making us understand the problem. Nah no need to, let me use my PHP crystal ball Hmmmmmm Hmmmmmm I see ... Line 394 is what you looking for Beware the evil ;! Nah just kidding hehe Couls be a lot of things bro. A PHP error or a MySQL error with repporting set to 0 would do that. Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-787749 Share on other sites More sharing options...
ashrobbins87 Posted March 18, 2009 Author Share Posted March 18, 2009 I think it is obvious from the lack of responses that none of us have any idea what you are talking about. How about more detail and I don't know some code might be very useful, and seeing that this might be a work in progress a link could also be helpful in making us understand the problem. No real need for that was there? Just a simple question from someone clearly not as experienced with the language as most of the users of this forum. Bit sarky don't you think? Ok so this is the menu page... <?php //check for required fields from the form if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) { header(("Locaction: home.php")); exit; } //connect to server and select database $mysqli = mysqli_connect("localhost", "root", "pass", "opp_group"); //create and issue the query $sql = "SELECT firstname, surname FROM cms_users WHERE username = '".$_POST["username"]."' AND password = MD5('".$_POST["password"]."')"; $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli)); //get the number of rows in the result set; should be 1 if a match if (mysqli_num_rows($result) == 1) { //if authorised, get the values of firstname and surname while ($info = mysqli_fetch_array($result)) { $firstname = stripslashes($info['firstname']); $surname = stripslashes($info['surname']); } //set authorisation cookie setcookie("auth", "1", 0, "/", "localhost", 0); //create display string $display_block = " <p>Hello ".$firstname.", please choose the feature you wish to change.</p> "; } else { //redirect back to login form if not authorised header("Location: home.php"); exit; } ?> <html> <head> <link rel="stylesheet" href="backend.css"> <title>CMS Menu</title> </head> <body> <br/> <div align="center"><h1>Welcome to the Blandford Opportunity Group Staff Portal</h1> <h2><?php echo "$display_block"; ?></h2></div> <br/> <table width="600" align="center" cellspacing="2"><tr> <td><img src="spanner.gif" height="30"></td> <td width="150" align="center" class="background" onClick="document.location.href='cms/manageusers.php'"><a href="cms/manageusers.php">Manage User Accounts</a></td> <td></td> <td width="150" align="center" class="background" bordercolor="#0066FF">Change Site Colour</td> <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> <td><form action="logoutcms.php" method="GET"><input type="submit" name="logout" value="Logout"/></form></td> </tr></table> <br/></br> </body> </html> And this is the updater, or "manage users" page that it links to.... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <title>Manage User Accounts</title> <link rel="stylesheet" href="../backend.css"> </head> <body> <div class="test"> <br/> <h1>Content Management System</h1> <p> <h2>Manage User Accounts</h2><a href="../cmsmenu.php">Back to Menu</a> </p> <br/> <hr/> <h3>Add a New User</h3> Complete the form below to add a new user <br/> <?php if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') { // add a new record to the database //Adding a new user $mysqli = mysqli_connect("localhost","root","pass","opp_group"); $f = $_POST['firstname']; $s = $_POST['surname']; $u = $_POST['username']; $p = $_POST['password']; $addUser_sql = "INSERT INTO cms_users (firstname, surname, username, password) VALUES ('$f', '$s','$u',MD5('$p'))"; $addUser_res = mysqli_query($mysqli, $addUser_sql) or die(mysqli_error($mysqli)); mysqli_close($mysqli); // reload page header("Location:manageusers.php"); exit(); } echo "<form method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\"> <table> <tr><td>First Name: </td><td><input type=\"text\" name=\"firstname\" size=\"20\" maxlength=\"25\"/></td></tr> <tr><td>Surname: </td><td><input type=\"text\" name=\"surname\" size=\"20\" maxlength=\"25\" /></td></tr> <tr><td>Username: </td><td><input type=\"text\" name=\"username\" size=\"15\"maxlength=\"10\"/></td></tr> <tr><td>Password: </td><td><input type=\"password\" name=\"password\" size=\"15\" maxlength=\"10\"/></td></tr> </table> <p><h4>Username is first letter of firstname followed by surname, max 8 characters. e.g. jsmith. <br/>Password must be exactly 8 characters long</h4></p> <input type=\"submit\" name=\"submit\" value=\"Submit\" /> <hr class=\"short\" align=\"left\"/> </form> "; ?> <h3>Edit or Delete a User</h3> Choose the user from the drop down list and click "View" to see their details.<br/><br/> <script type="text/javascript"> function eventWindow(url) { event_popupWin = window.open(url, 'event', 'resizable=yes,scrollbars=yes,toolbar=no,width=450,height=500'); event_popupWin.opener = self; } </script> <?php $mysqli = mysqli_connect("localhost","root","pass","opp_group"); //Get list of users in drop down $getUsers_sql ="SELECT id, firstname, surname FROM cms_users ORDER BY firstname"; $getUsers_res = mysqli_query($mysqli, $getUsers_sql)or die(mysqli_error()); echo "<form method=\"POST\" action=\"../user.php\" > <select name=\"users\">"; while ($row = mysqli_fetch_assoc($getUsers_res)) { echo '<option value="' . $row['id'] . '">' . $row['firstname'] . ' ' . $row['surname'] . '</option>'; $id = $row['id']; } echo "</select> <a href=\"javascript:eventWindow('../user.php?i=".$id."');\"> <input type=\"submit\" name=\"viewuser\" value=\"View\" /> </a>"; ?> </form> </div> </body> </html> I realise I probably didnt need to post all of this code, but I'm new with php, so I'm not sure which bits of code this will apply to. The problem is that when I select to go back to the menu page from the update users page, the menu page is blank, whether I do it from the browser back button, or from the link you can see in the code. Thanks for any helpguys, what does your crystal ball say now drisate????!!! Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-787936 Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 When you get to this blank page what does your header say or maybe I should say what does your url say? Trying to limit the scope of the problem down now as I am at work and do not have a test server in front of me. Maybe a bit "sarky" if you will but I got the information that I requested did I not? Also there has been a lot of very vague posters today, so really it was nothing personal. Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-787952 Share on other sites More sharing options...
drisate Posted March 18, 2009 Share Posted March 18, 2009 I could be wrong but this looks like a header problem So this is obviously an error stoping the page load. Try enabeling all errors. Put this is teh heander of your code error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-787962 Share on other sites More sharing options...
ashrobbins87 Posted March 18, 2009 Author Share Posted March 18, 2009 I've put that into my header, but I dont get any errors. The url that it is trying to load is http://localhost/Site%20Pages/cmsmenu.php which is the correct url for that page. Really don't know what's going on! Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-788009 Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 Now are you using a link or the back button? Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-788014 Share on other sites More sharing options...
ashrobbins87 Posted March 18, 2009 Author Share Posted March 18, 2009 Trying to use a link. Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-788018 Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 When you veiw the source what do you see and can we make this full proof for Appache and turn the contianing folder into something more like this. Site_Pages http://localhost/Site_Pages/cmsmenu.php Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-788023 Share on other sites More sharing options...
ashrobbins87 Posted March 18, 2009 Author Share Posted March 18, 2009 Ok I've updated the folder name, been meaning to do that for a while so thanks for the reminder!! The page source is completely blank, nothing at all. This is when viewed in 3 different browsers too..... Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-788039 Share on other sites More sharing options...
Zane Posted March 18, 2009 Share Posted March 18, 2009 look at output buffering Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-788045 Share on other sites More sharing options...
ashrobbins87 Posted March 23, 2009 Author Share Posted March 23, 2009 I dont understand how this helps me? Does anybody else have any ideas about why my pages might be not displaying and just giving me a blank screen? Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-792055 Share on other sites More sharing options...
ashrobbins87 Posted March 26, 2009 Author Share Posted March 26, 2009 Can anybody please help me out here? I am now using a simple hyperlink e.g. <a href="../cmsmenu.php">Back</a> ...but the page still returns blank. Does it have anything to do with the session variables being passed between each other?? Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-794365 Share on other sites More sharing options...
WolfRage Posted March 26, 2009 Share Posted March 26, 2009 Look, the most likely cause of your problem is out put buffering, just like Zanus said. So you need to take some time and research out put buffering, and how it relates to your issue. Then you need to see if adjustments to your buffer help you to fix this problem. Quote Link to comment https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/#findComment-794557 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.