Yes, a similar question was posted and answered correctly. Warning "Do not Access Superglobal $_POST Array Directly" on Netbeans 7.4 for PHP
That post was helpful. but it did not resolve my problem.
I am not getting any OUTPUT in my browser.
I applied all of the options exchanging $_POST with $_SERVER.
My original code:
$user_ip = $_SERVER[ 'REMOTE ADDR'];
My code modified several ways as the other question/ answer suggests
user_ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
user_ip = filter_input_array(INPUT_SERVER, 'REMOTE_ADDR');
STILL NO OUTOUT
Background.
I am appending code after code in my index.php as I go thru these tutorials.
I keep commenting out the previous code.
I missed a few comments and at that point I actually DID HAVE OUTPUT
::1
What I expected as output was
127,0,0,1
When I commented the all of the code from the previous tutorial I no longer get any output.
I am going thru a tutorial which is very good but he is using xampp. I am on a Mac and installed amp. Don't know if that matters.
If you want to take a look, navigate to thenewboston.com Tutorials Php Lesson 33 http://thenewboston.org/watch.php?cat=11&number=33 First minute or so in.
hope this works
no preview options and this makes it hard to comment upon the original post in a formatted fashion
code is
$user_ip = $_SERVER['REMOTE_ADDR'];
echo $string = 'your ip address is: '. $user_ip;
function echo_ip() {
$string = 'your ip address is: . '$user_ip;
output
`code`your ip address is: ::1 – iHaveAQuestion Feb 19 '14 at 19:20