Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Old PHP include code not working anymore, how to fix? [duplicate]

Ok so i want to have an include code on my index.php page that will include all of the other html pages within it. I used to do this using an id?=link.html link and this:

<?php 
$id = $HTTP_GET_VARS['id'];
if ( !$id || $id == "" )
 { 
 $number=10;
 include("news/show_news.php");
 } 
else
 { 
 include "$id"; 
} 
?>

but apparantly http_get_vars is unrecognized or something? How can I fix this so that it will work? Or if things have changed, why should I not use this kind of thing for includes?

like image 227
Phate Avatar asked Sep 09 '26 17:09

Phate


1 Answers

You can use $_GET to fetch the query string parameter by GET request, e.g.

index.php?id=123

The id value can be obtained by $_GET['id'].

p.s. your PHP codes are really old.

like image 86
Raptor Avatar answered Sep 11 '26 06:09

Raptor