I think this is the most common method to pass variable data into html tags and then insert this html into the database, below is an abstract of the method in a class (I'm using OOP),
Code: Select all
$content = '
<table>
<tr><td>
<p>Dear '.$this -> database -> real_escape_string($params['first_name']).',</p>
<p>Thank you for your order....</p>
<td>
</tr>
</table>';
$content = "'".$this -> database -> real_escape_string($content)."'";
$sql = " INSERT INTO invoices (content) VALUES($content)"
$result = $this -> database -> query($sql);I tried include() like this,
Code: Select all
$content = include 'template.php';So I tried file_get_contents(),
Code: Select all
$content = file_get_contents('template.php');it would be great if you have any ideas.
Many thanks,
Lau