Click here to Skip to main content
15,913,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am a newbie in php but I know well html and css, I have a code that creates php include function to work with html tables instead of frames. I want to ask what kind of code shall I put in navbar.html to change the main page? (eg. in frames there is target=main etc.)

PHP
/* Roddefig's index.php script (generic demo) */

$location=$_GET['location'];
if (empty($location)) {
$location='index';
}

changelocation($location);

function changelocation($location) {
include ('header.html');
echo '<table cols="2" border="0" cellpadding="10" cellspacing="0" align="center" width="100%">';
echo '<tr>';
echo '<td width="224" bgcolor="#0099FF" valign="top">';
include('navbar.html');
echo '</td>';
echo '<td bgcolor="#33CCFF">';
switch ($location) {
    case 'index':
        include ('actualindex.html');
        break;
    case 'tutorials':
        include ('http://www.genericsite.com/tutorials/index.html');
        break;
}
echo '</td></tr></table>';
include ('footer.html');
}


Thank you
Kyriakos
Posted

1 solution

you are using to include function to redirect.

try using header function;
example:
PHP
header('Location: '.location.'.php');


create a function like below:
PHP
function isset_val(&$var,$new)
{
 if(isset($var)==true)
  return $var;

 return $new;
}


now call the function like below:
PHP
$location=isset_val($_GET['location'],'index'); //if $_GET['location'] does not exists then index will be return; $location can also receive 0 length string.


fix rest of the issues
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900