Reputation: 93
I want pass some variable in file_get_contents() function.
<?php
extract($_POST);
$html_content= file_get_contents("counties/indrsen/1.php");
$tenant_html=$first_name.' '.$last_name."_$new.html";
file_put_contents("3_day_notice_fad/$tenant_html",$html_content);
?>
Where 1.php is simple php file, save in counties/indrsen. From above code I call 1.php and want save html file in other folder, name is 3_day_notice_fad with variables. It is saving successfully in folder, but when I open html file, it is not showing with variable name.
I want to pass variable $first_name and $last_name in file_put_contents("3_day_notice_fad/$tenant_html",$html_content);
1.php is below:
<p>To: Tenant's Name: <?php echo "$first_name.' '.$last_name"; ?> </p>
It shows html page like To: Tenant's Name:
But I want value it with values like like To: Tenant's Name: xyx jjj
Upvotes: 0
Views: 1642
Reputation: 93
Thanks to all for reply. I found my answer by
ob_start();
include('counties/indrsen/1.php');
$html_content = ob_get_contents();
ob_end_clean();
Its working fine.
Upvotes: 1