Jump to content

page not going back


f.ismayil

Recommended Posts

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>&#216kern Frukt og Gr&#248nt</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", "&#198", "&#216", "&#197");
         
$letters = array_merge(range("A", "Z"), array("&#38;#198", "&#38;#216", "&#38;#197"));


echo "<table border='0' align='center'>
        <tr>
          <td colspan=3><b><center>Du har valgt f&#248lgende 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>

Link to comment
https://forums.phpfreaks.com/topic/234095-page-not-going-back/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203359
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203628
Share on other sites

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? :)

Link to comment
https://forums.phpfreaks.com/topic/234095-page-not-going-back/#findComment-1203645
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.