2015-10-14 20:06
浏览 244


The 1st page is a search form that resubmits to itself and displays a list of homes. Then the user clicks on a home to display. When they are done looking at the home, they press the "back" button of the browser and then it is asking the user to refresh the page manually. I just want it to redisplay the last page as it was and not refresh it.

This is the way it used to work, but I cant figure out what caused it to start asking the user to refresh the page.

I'm not sure what code to show here. I'm using a Form with mostly PHP and very little JavaScript.

What could cause Page 1 to re-submit or refresh??

Update: I figured out that it has something to do with the PHP Session, however I dont know why its working correctly now:

This is the PHP code I had at the beginning of page:

`<?php  session_start();
$PrevNext = $_SESSION['PrevNextH'];
$queryH = $_SESSION['queryH'];

This is what I changed it to and it works fine now:

`       <?php   session_start();
        $PrevNext = $_SESSION['PrevNextH'];
        $queryH = $_SESSION['queryH'];

All I did was indent each line twice and the problem was solved. This does not make sense to me. Anyone know why this could happen?

图片转代码服务由CSDN问答提供 功能建议

第一页是一个重新提交给自己并显示住宅列表的搜索表单。 然后用户点击房屋进行显示。 当他们看完家时,他们按下浏览器的“后退”按钮,然后要求用户手动刷新页面。 我只是希望它重新显示最后一页,而不是刷新它。


I 我不确定在这里展示什么代码。 我正在使用一个主要是PHP和非常少的JavaScript的表单。


更新 :我发现它与PHP Session有关,但是我不知道为什么它现在正常工作:

这是我在页面开头的PHP代码:< / p>

 `&lt;?php session_start(); 
 $ PrevNext = $ _SESSION ['PrevNextH']; 
 $ queryH = $ _SESSION ['queryH']; 


 `&lt  ;?php session_start(); 
 $ PrevNext = $ _SESSION ['PrevNextH']; 
 $ queryH = $ _SESSION ['queryH']; 
   \  n 

我所做的只是每行缩进两次,问题就解决了。 这对我来说没有意义。 任何人都知道为什么会发生这种情况?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doufang8282 2015-10-15 20:10

    Apparently there are a few quirky issues with PHP. The reason that this problem started was that I went into the page and cleaned up some of the code. I removed the indention's in front of my PHP code before the "DOCTYPE HTML" tag.


    `<?php session_start();
    $PrevNext = $_SESSION['PrevNextH'];
    $queryH = $_SESSION['queryH'];
    <!doctype html>`

    The fix was either put the indention's back in there or from what I found on a few other post here, the best solution is to put the "DOCTYPE HTML" tag before the PHP which worked also:

    `<!doctype html>
    <?php session_start();
    $PrevNext = $_SESSION['PrevNextH'];
    $queryH = $_SESSION['queryH'];
    解决 无用
    打赏 举报

相关推荐 更多相似问题