Есть файлы под названием news1, news2, news1-2
Подскажите, что я неправильно написал, что выдает ошибку?
И какова причина ошибки?
Notice: Undefined index: num2 in
$sec = $_GET['num2'];
$fir = $_GET['num'];
$sec = $_GET['num2'];
if(!isset($sec)) {
$text = file_get_contents("news/news$fir.txt");
} else {
$text = file_get_contents("news/news$fir-$sec.txt");
}
echo $text;
при запросе
http://localhost/12.php?num=2
выдает ошибку Notice: Undefined index: num2 in, но после ошибки файл news2 всё же показан.
при
http://localhost/12.php?num=1&num2=2
всё чётко
