Jump to content

Stop Page Reloading


MasterRenny

Recommended Posts

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

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

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.