I have next code in my home.php file:
<html>
<body>
<table border="3">
<tr><td>
<a href="?page=my_page_1">Page 1</a>
</td></tr>
<tr><td>
<a href="?page=my_page_2">Page 2</a>
</td></tr>
</table>
<?php
if(isset($_GET['page'])){
$page = $_GET['page'];
$filename = $page.'.php';
if(file_exists($filename)){
include($filename);
}
else{
echo("File does not exist");
}
}
else{
echo("Page does not set");
}
?>
</body>
</html>
I'am expecting to page being reloaded as a certain .php file when one of the links is getting pressed. But, by some reason, nothing happens instead. Files "my_page_1.php" and "my_page_2.php" does exist and are located in the same folder with "home.php". I guess it doesn't work as I think it should, so could someone explain me what is really happening when links are getting pressed?
Seems like php would be executed only on and by the server and not as a simple script by your browser.