In Basic Terms Code is:
<html>
<h1>Current Expenses are</h1>
<?php
$success = ShowCurrentExpenses();
?>
<h2>Add and expense</h2>
<form action="" method="post">
PrintForm();
</form>
</html>
in the ShowCurrentExpenses(); (in an external file) is:
<?php
function ShowCurrMonExps($amount, $user, $date_array){
$sqlSTR = "select * from Expenses" ;
$result = mysql_query($sqlSTR, $conn);
if($result){
$rows = mysql_num_rows($result);
if($rows > 0){
?>
<table border='1'>
<tr>"
<th align='left'>Date</th><th align='left'>Description</th><th align='left'>Amount</th>
</tr>
<?php
while ($row = mysql_fetch_array($result)){
echo "<tr><td>" . $row['date'] . "</td><td>" . $row['description'] . "</td><td align='right'>" .$row['amount'] . "</td></tr>";
}
}
return true;
} else {
return false;
}
}
At present the output from show current expenses is outputed in the area between <h2>Add an expense </h2> and the output from the PrintForm() function.