I have created an php file that creates an invoice. The php file opens and creates an invoice number from a text file. I want to save this invoice to a file (HTML or pdf?) inside the invoice directory. the name should be the invoice number...can anyone help me with this. are there any scripts that will allow me to save this as a pdf?
Thanks in Advance
Here is the code i have so far.
<?PHP
$filename = 'order.txt';
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
fclose($fp);
$total= $_POST['Price']+$_POST['Price2']+$_POST['Price3'];
echo "<table border='1' width='953' id='table1' height='275'>";
echo "<tr>";
echo "<td colspan='4'>";
echo "<p align='center'><font size='5' color='#FF0000'>South Bend & Vicinity Electrical JATC<br></font><font size='2'>56365 Peppermint Rd.<br>South Bend, IN 46619<br>tel. (574) 233-1721</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2'>Sold To: ",$_POST['Name'], "</td>";
echo "<td colspan='2'>Invoice #", $contents,"</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='116'>ITEM:</td>";
echo "<td width='586'>", $_POST['Item'], "</td>";
echo "<td width='91'>PRICE</td>";
echo "<td width='132'>$ ", $_POST['Price'], "</td>";
echo "</tr>";
if ($_POST['Price2'] != NULL){
echo "<tr>";
echo "<td width=,'16'>ITEM:</td>";
echo "<td width='586'>", $_POST['Item2'], "</td>";
echo "<td width='91'>PRICE</td>";
echo "<td width='132'>$ ", $_POST['Price2'], "</td>";
echo "</tr>";
}
if ($_POST['Price3'] != NULL){
echo "<tr>";
echo "<td width='116'>ITEM:</td>";
echo "<td width='586'>",$_POST['Item3'], "</td>";
echo "<td width='91'>PRICE</td>";
echo "<td width='132'>$ ", $_POST['Price3'], "</td>";
echo "</tr>";
}
echo "<tr>";
echo "<td width='116'> </td><td width='586'> </td><td width='91'>TOTAL</td><td width='132'>$ ",$total, "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<br>";
echo "<center>";
echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>";
echo "<input type='hidden' name='cmd' value='_xclick'>";
echo "<input type='hidden' name='business' value='MyEmail@mydomain.com'>";
$name=$_POST['Item'];
if ($_POST['Price2'] != NULL){
$name=$_POST['Name'];
}
if ($_POST['Price3'] != NULL){
$name=$_POST['Name'];
}
echo "<input type='hidden' name='",$contents,"' value='",$contents,"'>";
echo "<input type='hidden' name='currency_code' value='USD'>";
echo "<input type='hidden' name='amount' value='",$total,"'>";
echo "<input type='image' src='http://www.paypal.com/en_US/i/btn/x-click-but01.gif' name='submit' alt='Make payments with PayPal - it's fast, free and secure!'>";
echo "</form>";
$fp = fopen($filename, "w");
$string = $contents+1;
$write = fputs($fp, $string);
fclose($fp);
?>