Ok. So, I'm working on a family banking system, but, I'm having a few problems with some of the code:
ministatements.php
I have two accounts numbers 123456789 and 1234567890.
- 1234567890 has the following balance:
Primary: Yes
Account Balance: 2000000.00
Unclear Balance: 1000000.00
Accured Interest: 1000.00
- 123456789 has the following balance:
Primary: No
Account Balance: 1050000.00
Unclear Balance: 100.00
Accured Interest: 500.00
However, no matter what account number I choose, it only pulls the information from the primary account.
Here is the following code and screenshots:
<?php
session_start();
include("header.php");
include("dbconnection.php");
//include("functions/inactive_session_logout.php");
if(!($_SESSION["customerid"]))
{
/*echo '<p style="color: red;">
This page has been accessed in error.<br>
You will be redirected to the login page in 5 seconds.<br>
If you are not redirected, please
<a href="emplogin.php">Click Here</a> to redirect.
</p>';
header("Location: login.php");*/
}
$accarray = mysql_query("SELECT * FROM accounts");
while($arrow = mysql_fetch_array($accarray))
{
$acno = $arrow[accno];
$prime = $arrow[primaryacc];
$accbal = $arrow[accountbalance];
}
$trans = mysql_query("SELECT * FROM transaction");
while($rows = mysql_fetch_array($trans))
{
$transdate = $rows[transactiondate];
$part = $rows[particulars];
$payee = $rows[payeeid];
$receive = $rows[receiveid];
$dep = $rows[depositac];
$deb = $rows[debitac];
$paystat = $rows[paymentstat];
}
$prime = $_POST[primaryacc];
if($prime == "yes")
{
echo "primary";
}
$acc = mysql_query("SELECT * FROM accounts");
$trans = mysql_query("SELECT * FROM transaction");
$result = mysql_query("SELECT * FROM customers
WHERE customers='$_SESSION[customerid]'");
?>
<link rel="stylesheet" type="text/css" href="css/form_style_view.css" />
<link rel="stylesheet" type="text/css" href="css/loan_nav.css" />
<div id="templatemo_main">
<span class="main_top"></span>
<div id="templatemo_content">
<?php
if(isset($_POST[submit]))
{
?>
<h2>Mini Statements</h2>
<form id="form1" name="form1" method="post" action="">
<div class="m" style=" width:399px;">
<div style="text-align:center; border:0px;
border-bottom:1px solid #000;">
<strong>
Balance Details - <?php echo $_SESSION[customername]; ?> -
[Details on <?php echo date("d-m-Y"); ?>]
</strong>
</div>
<div class="l" style="border:0px;
border-right:1px solid #000; width:130px;">
<strong>Account Number</strong>
</div>
<div class="r" style="border:0px;
border-bottom:1px solid #000;">
<?php echo $acno; ?> <?php echo $prime; ?>
</div>
<div class="clear"></div>
<div class="l" style="border:0px; border-top:1px solid #000;
border-right:1px solid #000; width:130px;">
<strong>Account Balance</strong>
</div>
<div class="r" style="border-top:1px #000 solid;
border:0px;">
<?php echo $accbal; ?>
</div>
<div class="clear"></div>
</div>
<p> </p>
<div class="m" style="width:794px;">
<div style="text-align:center; width:785px;">
<strong>Transaction Made</strong>
</div>
<div id="nav" style="width:795px;
border:0px; background-color:#CCCCCC;">
<div class="col1" style="width:130px;
border-left:0px; border-bottom:0px;">
<strong>Transaction Date</strong>
</div>
<div class="col2" style="width:80px;
border-left:0px; border-bottom:0px;">
<strong>Particulars</strong>
</div>
<div class="col3" style="width:90px;
border-left:0px; border-bottom:0px;">
<strong>Payee ID</strong>
</div>
<div class="col4" style="width:90px;
border-left:0px; border-bottom:0px;">
<strong>Receiver ID</strong>
</div>
<div class="col5" style="width:90px;
border-left:0px; border-bottom:0px;">
<strong>Deposits</strong>
</div>
<div class="col6" style="width:90px;
border-left:0px; border-bottom:0px;">
<strong>Withdraws</strong>
</div>
<div class="col7" style="width:100px;
border-left:0px; border-bottom:0px;">
<strong>Balance</strong>
</div>
<div class="col8" style="width:116px;
border-left:0px; border-bottom:0px;">
<strong>Payment Stats</strong>
</div>
<div class="clear"></div>
<?php
while($transaction = mysql_fetch_array($trans))
{
echo "<div>
<div class=\"row1\" style=\"width:130px;\">
$transdate
</div>
<div class=\"row2\" style=\"width:80px;
border-left:0px;\"> $part
</div>
<div class=\"row3\" style=\"width:90px;
border-left:0px;\"> $payee
</div>
<div class=\"row4\" style=\"width:90px;
border-left:0px;\"> $receive
</div>
<div class=\"row5\" style=\"width:90px;
border-left:0px;\"> $dep
</div>
<div class=\"row6\" style=\"width:90px;
border-left:0px;\"> $deb
</div>
<div class=\"row7\" style=\"width:100px;
border-left:0px;\"> $accbal
</div>
<div class=\"row8\" style=\"width:116px;
border-left:0px;\"> $paystat
</div>
</div>";
}
?>
</div>
</div>
</form>
<?php
}
else
{
?>
<form id="form1" name="form1" method="POST" action="">
<div class="m" style="width:398px;">
<div style="text-align:center; border-bottom:1px solid #000;">
<strong>Select an Account Number</strong>
</div>
<div style="border:0px;">
<div class="l" style="width:130px; border:0px;">
<label for="accno">
<strong>Account Number</strong>
</label>
</div>
<div class="r" style="width:264px; border:0px;">
<select name="accno" id="accno">
<option value="">Select Account Number</option>
<?php
while($rowsacc = mysql_fetch_array($acc))
{
echo "<option value='$rowsacc[accno] : $prime'>
$rowsacc[accno] : $prime
</option>";
}
?>
</select>
<input type="submit" name="submit"
id="submit" value="Submit" />
</div>
</div>
<div class="clear"></div>
</div>
</form>
<?php
}
?>
<p> </p>
<p> </p>
<div class="cleaner_h30"></div>
<div class="cleaner_h60"></div>
</div><!-- end of content -->
<div id="templatemo_sidebar">
<?php
include("myaccountssidebar.php");
?>
<div class="cleaner_h40"></div>
<h2> </h2>
</div>
<div class="cleaner"></div>
</div><!-- end of main -->
<div id="templatemo_main_bottom"></div><!-- end of main -->
<?php
include("footer.php");
?>