Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]struktura if else
marian84
post
Post #1





Grupa: Zarejestrowani
Postów: 185
Pomógł: 10
Dołączył: 29.01.2008

Ostrzeżenie: (0%)
-----


Mam prostą strukturę pliku index.php

Kod
(...)

if($_GET['str']=='foto')
{
    include('foto.php);
}
elseif($_GET['str']=='pliki')
{
    include('costam.php');
}
itd.

(...)


kod niestety wyswietla błąd:

Notice: Undefined index: str in (...) index.php on line 5

Czemu?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
marian84
post
Post #2





Grupa: Zarejestrowani
Postów: 185
Pomógł: 10
Dołączył: 29.01.2008

Ostrzeżenie: (0%)
-----


Kod
<?php
    include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Administracja</title>
        <meta name="Author" content="marian84">
        <meta name="copyright" content="....">
        <script type="text/javascript" src="js/menu.js"></script>
        <link rel="stylesheet" href="css/style.css" type="text/css" />
    </head>
    <body>
<?php
        if($_GET['str']=='foto')
        {
            include('foto.php);
        }
        elseif($_GET['str']=='pliki')
        {
            include('costam.php');
        }
?>
    </body>
</html>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 09:03