I collect data using client form and purchase form and then store it on db_clientData.php and db_purchaseData.php where I write it on the database tables clients and purchases.
Then on the db_salesReport.php file I access these two table but it does not show the new stored information but only the old rows that I imputed manually (not by using a form).
Why does it not show the new information?
Can someone tell me what am I missing?
New client form:
<form  action="db_clientData.php" method="post">
First Name: <input type='text' name='client_fname' /><br />
Last Name: <input type='text' name='client_lname' /><br />
City: <select name='client_city'>
    <option>Prishtine</option>
    <option>Mitrovice</option>
    <option>Peje</option>
    <option>Gjakove</option>
        <option>Ferizaj</option>
        <option>Prizren</option>
</select><br />
Gender: <select name='client_sex'>
    <option>F</option>
    <option>M</option>
</select><br />
Username(3-10 characters): <input type='text' name='client_username' /><br />
Password(3-10 characters): <input type='password' name='client_pass' /><br />
<input type='submit' value='Submit' />
<input type="reset" value="Clear" />
Purchase form:
    <form  action="db_purchaseData.php" method="post">
Book: <select name='purchase_book'>
    <option>Darka e gabuar</option>
    <option>Populli i ndalur</option>
    <option>Bageti e Bujqesi</option>
    <option>Fjala gdhend gurin</option>
        <option>Shtiegje Poetike</option>
        <option>Bashkohesit</option>
        <option>Colored Water</option>
        <option>Selected Poems</option>
        <option>Olivion Favorites</option>
</select><br />
Amount: <input type='number' name='purchase_amount' /><br />
<input type='submit' value='Submit' />
<input type="reset" value="Clear" />
</form>
Storing new client:
<?php
        include('db_login.php');
            // Connect
    $connection = mysql_connect($db_host, $db_username, $db_password);
        if (!$connection){
            die("Could not connect to the database: <br />". mysql_error( ));
        }
            // Select the database
    $db_select = mysql_select_db($db_database);
        if (!$db_select){
            die ("Could not select the database: <br />". mysql_error( ));
        }
$fname = isset($_POST['client_fname']) ? $_POST['client_fname'] : null;
$lname = isset($_POST['client_lname']) ? $_POST['client_lname'] : null;
$city = isset ($_POST['client_city']) ? $_POST['client_city'] : null;
$sex = isset($_POST['client_sex']) ? $_POST['client_sex'] : null;
$username = isset ($_POST['client_username']) ? $_POST['client_username'] : null;
$pass = isset ($_POST['client_pass']) ? $_POST['client_pass'] : null;
$sql = "INSERT INTO clients (client_fname, client_lname, client_city, client_sex, client_username, client_pass) VALUES ('$fname','$lname','$city','$sex','$username',MD5('$pass'))";
mysql_query($sql, $connection);  
mysql_close();
echo "Data stored on database."; 
?>
<a href="db_testAuth.php"><br><input type='button' value='Log In'></a>
Storing new purchase:
<?php
        include('db_login.php');
            // Connect
    $connection = mysql_connect($db_host, $db_username, $db_password);
        if (!$connection){
            die("Could not connect to the database: <br />". mysql_error( ));
        }
            // Select the database
    $db_select = mysql_select_db($db_database);
        if (!$db_select){
            die ("Could not select the database: <br />". mysql_error( ));
        }
$bookname = isset($_POST['purchase_book']) ? $_POST['purchase_book'] : null;
$bookamount = isset($_POST['purchase_amount']) ? $_POST['purchase_amount'] : null;
$sql = "INSERT INTO purchases (purchase_book, purchase_amount) VALUES ('$bookname','$bookamount')";
mysql_query($sql, $connection);  
mysql_close();
echo "Data stored on database."; 
?>
<a href="db_salesReport.php"><br><input type='button' value='Sales Report'></a>
Calling data on db_salesReport.php:
<body>
<p>Sales Report</p>
<table border="2">
    <tr>
        <th>Client ID</th>
        <th>Name</th>
        <th>Surname</th>
        <th>Username</th>
        <th>Purchase ID</th>
    <th>Book title</th>
    <th>Amount</th>
    </tr>
   <?php
            //Include our login information
    include('db_login.php');
            // Connect
    $connection = mysql_connect($db_host, $db_username, $db_password);
        if (!$connection){
            die("Could not connect to the database: <br />". mysql_error( ));
        }
            // Select the database
    $db_select = mysql_select_db($db_database);
        if (!$db_select){
            die ("Could not select the database: <br />". mysql_error( ));
        }
            // Assign the query
    $query = "SELECT clients.client_id, clients.client_fname, clients.client_lname, clients.client_username, purchases.purchase_id, purchases.purchase_book, purchases.purchase_amount from clients,purchases where clients.book_id=purchases.book_id;";
            // Execute the query
        $result = mysql_query($query);
        if (!$result){
            die ("Could not query the database: <br />". mysql_error( ));
        }
            // Fetch and display the results
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
        $client_id = $row["client_id"];
        $client_fname = $row["client_fname"];
        $client_lname = $row["client_lname"];
        $client_username = $row["client_username"];
    $purchase_id = $row["purchase_id"];
        $purchase_book = $row["purchase_book"];
    $purchase_amount = $row["purchase_amount"];
            echo "<tr>";
            echo "<td>$client_id</td>";
                        echo "<td>$client_fname</td>";
            echo "<td>$client_lname</td>";
            echo "<td>$client_username</td>";
            echo "<td>$purchase_id</td>";
                        echo "<td>$purchase_book</td>";
            echo "<td>$purchase_amount</td>";
            echo "</tr>";
        }
                // Close the connection
    mysql_close($connection);
   ?>
</body>
</html>
 
     
    