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
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 )

 

Link to comment
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 )

 

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)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.