I'm making a site using divs. I have one across the top with a row of links which I want to change what's in the main window. I would prefer to keep strictly to PHP and HTML and use a full page refresh as I am comfortable with them at current, rather than using an Ajax refresh as I don't have any knowledge of Ajax.從<a href=""> link
I don't want to use iframes. I thought the best way to do this would be as follows:
<div id="top">
<a href="news.html">News</a>
</div>
<div id="main">
<?php include($page); ?>
</div>
What I need is a way of changing the $page
variable upon clicking the link. If this means changing the variable and then reloading the page then so be it.
A command following the logic of:
<a href="news.html" action="<?php $page="news.html"; ?>">News</a>
would be ideal! I thought about using a form, but it seems there should be an easier way.
我認爲什麼是被要求在這裏是如何加載一個新的HTML/PHP頁面中的一個div。你可以使用jQuery的負載來完成。看到一個類似的問題[這裏](http://stackoverflow.com/questions/3564356/loading-html-page-inside-div?rq=1) –
你不需要分析一個變量,你只需要檢查什麼當前頁面是,這個信息就是$ _SERVER數組。 – 2012-07-03 21:10:21
或者您可以通過'和'include($ _ GET ['target']);' –