Hello i have a php file called a.php that includes a specific value example : $a = 0; i just want to print this value (a) in a html file called b.html is that possible ? thanks
Sure, you have to open php tag, include php file, echo variable and close php tag For example:
<p><?php include('a.php'); echo $a; ?></p>
This will work..
<?php
ob_start();
$a = 1;
echo $a; // echo $a value
file_put_contents('b.html', ob_get_contents()); // save the output to b.html
?>
However, if you already have other content in the existing page all of them will be there in the html file. Therefore you can POST the variable $a to a separate php file as follows..
<?php
ob_start();
$a = $_POST["aVar"];
echo $a;
file_put_contents('b.html', ob_get_contents());
?>