Including a PHP file and variable

Hello,

I am new to PHP and I have not been able to come with a solution to my problem after reading various help files. Any help is greatly appreciated.

I have a php file named status.php and it has code that displays the status of a server. It was free code from github and it is working correctly when I call it using: http://rpi3/status.php
it also has an option to call it using this:
http://rpi3/status.php?showtraffic=m
which adds some extra feature (network traffic data). Again, working fine from my browser.

The problem is when I try to include the status.php file in my index.php file. I am using this:
include("status.php");
and it works fine. I tried this:
include("status.php?showtraffic=m");
and it fails to display.

I have tried this also:
include("status.php");
$showtraffic=m;
still no luck.

Any idea how to make this work?

You are not using include properly. Kindly go through w3schools and then use it.

1 Like

Thank you, I have seen the errors of my ways.

Sorry,

Sponsor our Newsletter | Privacy Policy | Terms of Service