Following code is saved as html file:
<?php
$IP = 4;
?>
<textarea name="comments">$IP</textarea>
I want to access the value of php variable in html tags. Example I want the value of IP to be displayed in textarea.
You can execute .html files as .php files by adding a line to your .htaccess file..
AddType application/x-httpd-php .html
And obviously use the <?php echo $variableName; ?> style syntax
use this:
<textarea name="comments"><?php echo $IP; ?></textarea>
it is not possible to access in html, simply save the page in '.php' and if you want to change url, means .html instead of .php then use .htaccess
Here is a short tutorial on using PHP in HTML pages. Note that in order to use PHP in an HTML page, you need to save the page with a .php extension.
to answer your question above, you need to do the following:
<?php
$IP =4;
?>
<textarea name="comments"><?php echo $IP;?></textarea>
<textarea name="comments"><?php echo $IP ?></textarea>
Extra cool stuff (for free!!!):
http://php.net/manual/en/install.php
http://www.php.net/manual/en/tutorial.firstpage.php
http://devzone.zend.com/6/php-101-php-for-the-absolute-beginner/
etc, etc...
.htmlextension??