How to call a php file dynamically in a index.php after clicking a link in it?

Tech?

New member
I tried some tutorials that showed if you click on a link in index.php
it would show another php file in index.php without refresh
<a href="index.php?page=tutorials">
tutorials</a>

I tried doing it but doesn't work for me, code is the same with that tutorial but it gives me an error
ERROR:
Notice: Undefined index: tutorials in C:\wamp\www\dynamic\index.php on line 21


CODE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<table width="422" height="220" border="1" cellpadding="0" cellspacing="2">
<tr>
<th width="87" scope="col">Header</th>
</tr>
<tr>
<td>
<a href="index.php">Home</a><br>
<a href="index.php?page=tutorials">
Tutorials</a>
</td>
<td width="323">
<?php

$page = $_GET['page'];
if($page){
include('inc/' .$page.'.php');
}
else{
echo "<b>Start Home</b>";
}
?>
</td>
</tr>
</table>
</body>
</html>

I'm using WAMP and its PHP is v5.3.0
I wish to use it on something, I'm working on.
 
Back
Top