keiby Posted May 22, 2004 Report Share Posted May 22, 2004 ir fails index.php, kuraa prieksh menu tiek izmantota shaada lieta : <?php switch ($_GET['go']) { case "1": $inc = 'Page01.php'; break; case "2": $inc = 'Page02.php'; break; case "3": $inc = 'Page03.php'; break; case "4": $inc = 'Page04.php'; break; default: $inc = 'Page01.php'; break; } include ($inc); ?> kameer darbojas ar menju, piemeeram, index.php$go=2 ir viss kaartiibaa, bet kad atver saakuma lapu - pliku index.php izmet kljuudu : "Notice: Undefined index: go in ...". Kaut arii peec shiis kljuudas pazinjojuma paraadaas texc, kas bija paredzeec (Page01.php). Link to comment Share on other sites More sharing options...
Aleksejs Posted May 22, 2004 Report Share Posted May 22, 2004 Tas tādēļ, ka tajā brīdī nav nodefinēts $_GET['go'] mainīgais. Vai nu izmaini kodu, lai pārbauda, vai ir uzstādīts šis mainīgais - isset Vai izmaini kļūdu paziņojumu līmeni, lai ignorē notice. Vai pieliec @ zīmi - switch (@$_GET['go']) - lai neģenerētos kļūdas paziņojums. Link to comment Share on other sites More sharing options...
rnc Posted May 23, 2004 Report Share Posted May 23, 2004 (edited) Sķiet, ka switch`am ar to tak nebija problēmas, bet laikam nepareiz atceros :-). Enivej, pēc Alekseja teiktā iznāk šadi. <?php if (!isset($_GET['go'])) $inc = 'Page01.php'; else { switch ($_GET['go']) { case "1": $inc = 'Page01.php'; break; case "2": $inc = 'Page02.php'; break; case "3": $inc = 'Page03.php'; break; case "4": $inc = 'Page04.php'; break; default: $inc = 'Page01.php'; break; } } include ($inc); ?> Edited May 23, 2004 by rnc Link to comment Share on other sites More sharing options...
keiby Posted May 24, 2004 Author Report Share Posted May 24, 2004 taa kaa negribu sleegt aaraa notice pazinjojumus - maz kas gadaas uz dazhaadiem serveriem. tad shitais varianc paliidzeeja. thnx. Link to comment Share on other sites More sharing options...
Recommended Posts