Changing PHP variable from an <a href=""> link
Posted
by
aener
on Stack Overflow
See other posts from Stack Overflow
or by aener
Published on 2012-07-03T21:05:43Z
Indexed on
2012/07/03
21:15 UTC
Read the original article
Hit count: 151
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.
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.
© Stack Overflow or respective owner