MasterRenny Posted September 6, 2008 Share Posted September 6, 2008 Hello, Im not all that good at php so sorry if my code isnt very good. Im trying to make it so when i click a link it changes the subnavs, however whenever i click the link the whole page reloads. therefore is there a way for me to stop the page from reloading. Heres my code; <a class="home" href="index.php?p=home"></a> <?php $var = "p"; $defaultname = "home"; $default = "home.php"; if (file_exists("files/$_GET[$var].php")) { include ("files/$_GET[$var].php"); } else if ($_GET[x] == "$defaultname" || !$_GET[$var]) { include("$default"); } else { echo("<h2>Error</h2>Page doesn't exist"); } ?> Thanks, Renny Link to comment https://forums.phpfreaks.com/topic/123036-stop-page-reloading/ Share on other sites More sharing options...
BlueSkyIS Posted September 6, 2008 Share Posted September 6, 2008 PHP is processed on the server. so for PHP to change anything, a request has to be sent to the server and the page refreshed. one way to get around this would be ajax (javascript working with PHP). Link to comment https://forums.phpfreaks.com/topic/123036-stop-page-reloading/#findComment-635308 Share on other sites More sharing options...
MasterRenny Posted September 6, 2008 Author Share Posted September 6, 2008 PHP is processed on the server. so for PHP to change anything, a request has to be sent to the server and the page refreshed. one way to get around this would be ajax (javascript working with PHP). Ok thanks ill look in to it. though dont surpose you have any idea what i should search..etc? ??? Link to comment https://forums.phpfreaks.com/topic/123036-stop-page-reloading/#findComment-635320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.