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


#1

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 brokeloose@NOSPAMhotmail.com


#2

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.


#3

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 ";?


#4

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]

#5

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


#6

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.