Problém s proměnou ve skriptu Vyřešeno
Napsal: 20 úno 2013 18:54
Zdravím, vytvářím jednoduché stránky na bázi php a při tvorbě skriptu na získání získání parametru z URL se mi zoobrazil Notice: Undefined index: text in C:\Program Files (x86)\xampp\htdocs\navex\index.php on line 22. (Tj. $text=htmlspecialchars(strip_tags($_GET['text']));)
Přikládám zdrojový kód celého souboru index.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>NavEx</title>
<link rel='shortcut icon' href='icon.png'>
<link rel="stylesheet" type="text/css" href="stylopis.css">
</head>
<body>
<div id="stranka">
<div id="logo">
<?php require ("logo.php")?>
<?php require ("horizontal.php"); ?>
</div>
<hr class="noscreen" />
<div id="obsah">
<div id="obsah-in">
<?php
$text=htmlspecialchars(strip_tags($_GET['text']));
if($text==''){
$text='uvod';
}
if (file_exists($text.'.php')) {
require $text.'.php';
} else {
require '404.php';
}
?>
</div>
</div>
<div id="navigace">
<div id="navigace-in">
<?php require ("rubriky.php"); ?><br>
</div>
</div>
<div class="cleaner"> </div>
<hr class="noscreen" />
<div id="pata">
<?php require ("pata.php"); ?>
<br>
</div>
</div>
</body>
</html>
Nevím, v čem je problém. Za každou radu díky!
Přikládám zdrojový kód celého souboru index.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>NavEx</title>
<link rel='shortcut icon' href='icon.png'>
<link rel="stylesheet" type="text/css" href="stylopis.css">
</head>
<body>
<div id="stranka">
<div id="logo">
<?php require ("logo.php")?>
<?php require ("horizontal.php"); ?>
</div>
<hr class="noscreen" />
<div id="obsah">
<div id="obsah-in">
<?php
$text=htmlspecialchars(strip_tags($_GET['text']));
if($text==''){
$text='uvod';
}
if (file_exists($text.'.php')) {
require $text.'.php';
} else {
require '404.php';
}
?>
</div>
</div>
<div id="navigace">
<div id="navigace-in">
<?php require ("rubriky.php"); ?><br>
</div>
</div>
<div class="cleaner"> </div>
<hr class="noscreen" />
<div id="pata">
<?php require ("pata.php"); ?>
<br>
</div>
</div>
</body>
</html>
Nevím, v čem je problém. Za každou radu díky!
