Jump to content
  • 0

Переход по ссылке методом GET


romantik2011
 Share

Question

Написал сам код, проблема в меню, получается переход на ссылку

http://test.ru/index.php/index.php/index.php?id=page1

вместо указанной мною в коде http://test.ru/index.php/?id=page1

Подскажите, где не так? Архив вложил, вот его главный файл и файл меню.

index.php


<?php include 'menu.php';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Основы блочной верстки (Div верстки)</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div id="wrapper">
<div id="header"><span style="font-size:34px;">Сайт</span></div>

<div id="left">
<h2 style="border-bottom:1px solid black;">Menu</h2>
<? getMenu($menu);?>
</div>


<div id="right"><h2 style="border-bottom:1px solid black;">Menu</h2>
<? getMenu($menu);?>
</div>
<div id="kontent">
<?php
$id = (isset($_GET['$id']))?$_GET['$id']:include 'home.php';
switch($id){
case 'page1': include 'page1.php'; break;
case 'page2': include 'page2.php'; break;
case 'page3': include 'page3.php'; break;
}
?>
</div>
<div id="footer">Copyright © Филип Киркоров <? echo date('Y'); ?></div>

</div>
</body>
</html>

menu.php


<?php
$menu = array(
'Page1' => 'index.php?id=page1',
'Page2' => 'index.php?id=page2',
'Page3' => 'index.php?id=page3'
);


function getMenu($masiv){
echo '<ul>';
foreach($masiv as $href=>$value){
echo "<li><a href=\"$value\">$href</a></li>";
}
echo '</ul>';
}

?>

Архив: http://www.onlinedisk.ru/file/727752/

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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. See more about our Guidelines and Privacy Policy