Adding a pre-written code to table?!?!?

This is the code for a table:

<?php echo "
Information
<print ('User IP: $REMOTE_ADDR
"; ?>

If i execute this code and upload it to my site, i get a table inwhich displays your IP adress. But now i have another code which i want to appear below the ip adress, the code is as follows:

<?include("/home/www/thefatkid.freeserverhost.net/counter/counter.php");?>

This is what i get, its the code for a hitcounter i installed. Can anyone edit the overall table code so that the hitcounter displays under the ip? I don’t know where to place it. I’ve tried this:
<print ('User IP: $REMOTE_ADDR

<?include("/home/www/thefatkid.freeserverhost.net/counter/counter.php");?> "; ?>

This doesn’t work. Can anyone with great knowledge solve this for me?
PS. private message me with a solution or email me at [email protected]

Sorry we don’t email or PM solutions. They are posted so the whole community can see how it is done.

What you need to do is end your echo statement right before where you want to put the include. Remove the <? and ?> parts of the include line (you are already in the PHP parser) and plop it in. Then restart your echo statement.

I’ve understood as much:

"; <------this is the end echo statement?

So if i do it right, it would look like this:

"; echo "include("/home/www/thefatkid.freeserverhost.net/counter/counter.php");

Do i put the ‘echo’ before or after the include ? Do i then end it with ";?

I don’t normally do this (and don’t like doing it)- but …

[php]

Information
User IP: <? echo $REMOTE_ADDR; ?>"; <?include("/home/www/thefatkid.freeserverhost.net/counter/counter.php");?>
[/php]

I’m confused now, first you told me to remove the <? ?> . Also, does it work for you? It didn’t work for me before.

What I did is remove the echo statement for all your basic HTML (PHP and HTML can happily co-exist) and just put in PHP tags (<? ?>) where we actually want to do something with the PHP - display the remote IP address and include the file.

I assume you are a newbie that is very shiny. I suggest you get a book and read a few of the online tutorials - what I am doing is VERY basic for PHP.

Sponsor our Newsletter | Privacy Policy | Terms of Service