Jump to content

Display values on current screen.


wejofost

Recommended Posts

Very simple problem but got me beat.

I am trying to capture and print on the screen the IP address that is looking at my webpage.

After a lot of research I believe I have the data but cannot print it in PHP ( in an ASP WRITE RESPONSE type manner)

Here is my test page.  What am I doing wrong ?!

:confused:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

 

<html>

<head>

<title>Untitled</title>

</head>

 

<body>

<?php

    $page ='Test page';

 

 

 

 

$ipaddress = $_SERVER['REMOTE_ADDR'];

$date = date ("M dS H:i:s");

 

$message = "$page _ $ipaddress _ $date\n";

 

 

$File = "track.txt";

$Open = fopen($File, "a+");

if ($Open){

 

fwrite($Open, "$message");

fclose ($Open);

}

 

 

<br>

print this is a print on the screen statement; <br>

print $message; <br>

<br>

Some test data to see if it can be displayed.

$result = "OK";

$update = "Yes";

$updateid = "90094";

 

echo "result=".$result."\n";

echo "update=".$update."\n";

echo "updateid=".$updateid."\n";

 

?>

 

 

 

 

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/186968-display-values-on-current-screen/
Share on other sites

Thank you Mike . I have added your suggested line to my test page.

 

I have 4 similar lines in my test page but echo is displaying the code but not displaying results on the screen??

 

Please look at test page www.theparrys.co.uk/test.html

It is something stupid that I am doing ( or not doing more likely )

 

Thank you Mike . I have added your suggested line to my test page.

 

I have 4 similar lines in my test page but echo is displaying the code but not displaying results on the screen??

 

Please look at test page www.theparrys.co.uk/test.html

It is something stupid that I am doing ( or not doing more likely )

 

You should really read up on the php documentation (look at my sig), And i'm sure there are many tutorials out there that show the differences between ASP and PHP. Like asp, PHP has it's own file extension and opening style tags. (Note PHP >=5.0 is the current version of PHP, 4.0 and register_globals you should stay away from while learning)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.