f.ismayil Posted April 18, 2011 Share Posted April 18, 2011 I have the following code. Before back button was working. Now don't understand what happend but when I click Back button I receive "Webpage has expired" window in my browser. What may be the reason? <html> <head> <title>Økern Frukt og Grønt</title> <link href="calendar/calendar.css" rel="stylesheet" type="text/css" /> <script language="javascript" src="calendar/calendar.js"></script> <style type="text/css"> textarea { resize: none; } </style> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"/> </head> <?php if(!isset($_POST['userid'])) { echo "<script type='text/javascript'>"; echo "window.location = 'login.html'"; echo "</script>"; exit; } require_once ('functions.inc'); require_once('calendar/classes/tc_calendar.php'); global $default_dbname; $link_id = db_connect($default_dbname); mysql_select_db("okern", $link_id); $letters1 = array ("A1", "B1", "C", "D","E", "F", "G", "H","I", "J", "K", "L", "M", "N", "O", "P","Q", "R", "S", "T","U", "V", "W", "X", "Y", "Z", "Æ", "Ø", "Å"); $letters = array_merge(range("A", "Z"), array("&#198", "&#216", "&#197")); echo "<table border='0' align='center'> <tr> <td colspan=3><b><center>Du har valgt følgende produkter</center></b></td> </tr> <tr> <th align=left>Produkt</th> <th align=left>Antall</th> <th align=left>Enhet</th> </tr>"; echo "<form method='POST' action='order.php'>"; $userid = $_POST['userid']; echo "<INPUT TYPE='hidden' NAME='userid' VALUE='$userid'>"; foreach($letters as $letter) { if(isset($_POST[$letter])) { $selected = $letter . '1'; $antall = $letter . '2'; $enhet = $letter . '3'; echo "<tr>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$selected' VALUE='$_POST[$selected]'>" . "$_POST[$selected]" . "</td>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$antall' VALUE='$_POST[$antall]'>" . "$_POST[$antall]" . "</td>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$enhet' VALUE='$_POST[$enhet]'>" . "$_POST[$enhet]" . "</td>"; echo "</tr>"; } } for ($i = 1; $i < 400; $i++) { if (isset($_POST[$i])){ $selected = 'a' . $i; $antall = 'antall' . strval($i); $enhet = 'enhet' . strval($i); echo "<tr>"; echo "<td>" . "$_POST[$selected]" . "</td>"; echo "<td>" . "$_POST[$antall]" . "</td>"; echo "<td>" . "$_POST[$enhet]" . "</td>"; echo "</tr>"; } } echo "<tr height=10></tr> <tr><td colspan=2>Velg dato for bestillingen:</td> <td colspan=1>"; $myCalendar = new tc_calendar("date5", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2015); $myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('j F Y'); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->writeScript(); echo "<INPUT TYPE='hidden' NAME='date' VALUE='this.form.date5.value'>"; echo "</td></tr>"; echo "<tr height=10></tr><tr> <td colspan=3>Skrive din melding nedenfor:</td> </tr>"; echo "<tr> <td colspan=3><textarea name='melding' cols='50' rows='5' resize=none></textarea></td> </tr>"; echo "<tr> [b]<td><center><input type='button' value='Tilbake' onClick='history.go(-1)'></center></td>[/b] <td colspan=2><center><input type='submit' value='Bestil'></center></td> </tr>"; echo "</form>"; echo "</table>"; ?> </html> Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/ Share on other sites More sharing options...
dcro2 Posted April 18, 2011 Share Posted April 18, 2011 That usually means that a form was submitted to that page. The browser doesn't automatically reload it because it may cause something to happen again (like a purchase for example) by POSTing the information again to that page. Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203188 Share on other sites More sharing options...
f.ismayil Posted April 18, 2011 Author Share Posted April 18, 2011 But before back was working. Actually in back page there is a sql command that takes the list of products from mysql table and shows this inside html table. Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203196 Share on other sites More sharing options...
f.ismayil Posted April 18, 2011 Author Share Posted April 18, 2011 Even when I was cheking checkboxes and pressing next button, after going back the same checkboxes where checked. Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203197 Share on other sites More sharing options...
maxudaskin Posted April 18, 2011 Share Posted April 18, 2011 You cannot use the header function after the <head> tag is placed in HTML. Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203201 Share on other sites More sharing options...
f.ismayil Posted April 19, 2011 Author Share Posted April 19, 2011 Which part of code do you mean? <link href="calendar/calendar.css" rel="stylesheet" type="text/css" /> <script language="javascript" src="calendar/calendar.js"></script> <style type="text/css"> textarea { resize: none; } </style> I removed this part from code but still it is not going back. Is it possible that problem is not in this php file? May be it is in previous php file.What you think? Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203359 Share on other sites More sharing options...
dcro2 Posted April 19, 2011 Share Posted April 19, 2011 Yes. Do you use any $_POST in the previous page? Remember, that javascript will take you back one page in the current tab/window's history, so make sure that's actually what you think it is. Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203385 Share on other sites More sharing options...
f.ismayil Posted April 19, 2011 Author Share Posted April 19, 2011 Yes I use $_POST in previous page. I may even give whole code of previous page. I will be a bit big. Hope it will help to find the source of problem [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203623 Share on other sites More sharing options...
dcro2 Posted April 19, 2011 Share Posted April 19, 2011 Did you switch browsers or something? Because, again, this is because you sent POST information through a form to the page you're trying to go back to. Most browsers will tell you the page has expired and to refresh if you want to re-submit the form. They do this because if, for example, you had just clicked the 'buy' button on the page before that, it might mean that you're buying or paying for it again. Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203628 Share on other sites More sharing options...
f.ismayil Posted April 19, 2011 Author Share Posted April 19, 2011 Intention is like that user selects products that he/she wants to buy and presses next button. At the next page user will see overview of selected products. And if he/she wants to order something extra he/she should be able to go back. Before it was sending $_POST to other php file but still could go back. So I will slowly remove some parts of code in order to find where is the problem. Is it good idea? Quote Link to comment https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203645 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.