I try to run project and get localhost:8000/fishes.php
and then change it to localhost:8000/fishes.php?fish=pike
(or trout).
I have directories on same project /info/pike
(or trout) and in these directories there is info.txt
where first line has fish latin name and second line has average size.
My question is, How can I get text from that file to "site". Code doesn't include html-code, I don't have the code right now with me. But it is fine and runs normally.
Thanks
<?php
$species = $_GET["fish"];
if (file_exists("info.txt")) {
$array = explode("/n", file_get_contents('$species/info.txt'));
$name = $array[0];
$size = $array[1];
} else {
}
global $name;
global $size;
?>
<h1><?php$name?> (<?php$size?>)</h1>