how to call PHP script from HTML

General software, Operating Systems, and Programming discussion.
Everything from software questions, OSes, simple HTML to scripting languages, Perl, PHP, Python, MySQL, VB, C++ etc.
Post Reply
User avatar
catngo
Regular Member
Posts: 213
Joined: Mon Dec 11, 2000 12:00 am
Location: Oklahoma City

how to call PHP script from HTML

Post by catngo »

this is my php script that will display client IP address:

<HTML>
<HEAD>
<TITLE></TITLE>
<BODY>
<?php
$userip = $REMOTE_ADDR;
echo $userip
?>
</BODY>
</HTMP>

and the filename of this is ip.php

if i call this script alone, it will show my ip address. (my IIS 5.0 is PHP enable). now, i want to embed this script into my html file.

example: to call an image in an HTML i use <IMG src="image.jpg">
in this case, i want PHP script instead of image.


thanks
cat
Stu
Regular Member
Posts: 341
Joined: Tue Aug 10, 1999 12:00 am

Post by Stu »

Just give the file a .php extension. Example: index.php
IHateExcite
Member
Posts: 22
Joined: Wed Jan 02, 2002 1:57 am

Post by IHateExcite »

Code: Select all

<html>
  <body>
    <?php
      $userip = $REMOTE_ADDR;
    ?>
    IP address:  <?php PRINT("$userip"); ?>.
  </body>
</html>

At least I think that's what you want to do.
--4oh4
Post Reply