This page generates a table that contains all the data on the billing_reports table in my database. When you double click on an item, you can enter in a new value in the field, then press enter to save. The problem is that when I press submit, it just refreshes the page, without updating the changes to the database. How do I fix this?
<?php
include_once ("includes/config.php");
include_once ("includes/functions.php");
include_once ("includes/header.php");
?>
<!--How this works, is that this page generates a table that containes all
the data on the billing_reports table in my database. When you double
click on an item, you can enter in a new value in the field, then press
enter to save. The problem I am having, is that when I press submit it
just refreshes the page, when I want it to update the changes to the database.
How do I fix this? -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<?php
// $data = All the rows in billing reports
$data = mysql_query("SELECT * FROM billing_reports")
or die(mysql_error());
// This is printing the Javascript table listed above
?> <table class="editableTable"> <?php
Print "<editableTable border cellpadding=4>";
//This is defining $info as the action that seperates the $data pulled from the database
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th>Name:</th> <td>".$info['cc_name'] . "</td> ";
Print "<th>ID:</th> <td>".$info['br_id'] . "</td> ";
Print "<th>Listing ID:</th> <td>".$info['listing_id'] . "</td> ";
Print "<th>Payment:</th> <td>".$info['billing_amount'] . "</td> ";
Print "<th>Status:</th> <td>".$info['status'] . " </td></tr>";
}
Print "</table>";
if (!$_POST['submit']) {
$result = mysql_query($info);
$person = mysql_fetch_array($result);
}
if(isset($_POST['submit'])) {
$info = "UPDATE billing_reports SET cc_name='$_POST[cc_name]', br_id='$_POST[br_id]', listing_id='$_POST[listing_id]', billing_amount='$_POST[billing_amount]', status='$_POST[status]'";
mysql_query($info) or die(mysql_error());
echo"Agent has been modified!";
}
?>
<form action="" method="post" class="button">
<li>Save Changes</br>
<input type="submit" <name="submit" value="Modify"/></li>
</form>
<?php
include_once ("includes/footer.php");
?>