notsoevilgenius
MIS
I have a donation list page that displays data from the donation and donor tables. I put a record edit link on each row and on the record edit page where I know have the donor_id I'd like to display the donor name (stored in the donor table) associated with that donation record but have it locked so the user can't change that information on that page.
Code right now...
Yes I know I'm using an older code version. Switching in the middle of this project will confuse me even further. Once everything is working I'll start learning the new stuff and rewrite the code and it will make more sense to me.
Thanks!
Code right now...
Code:
<?php
$id = $_GET['id'];
$sql = "SELECT * FROM donations WHERE donor_id = '$id'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
//Extract fields.
$donor_id=$_POST['donor_id'];
$date=$_POST['date'];
$amount=$_POST['amount'];
$donation_cat=$_POST['donation_cat'];
$miscellaneous=$_POST['miscellaneous'];
$note=$_POST['note'];
?>
<h1>Donation Details</h1>
<div class="table-sortable:default">
<p style="margin-left:25px;"> Edit Donation Record</p>
<form action="updateDonation.php" method="post">
<input type="hidden" name="id" value="<? echo $id ?>" />
<table>
<tr><td>Donor: </td></td><td><input type="text" name="donor_id" value="<?php echo $row['donor_id']; ?>"></td></tr>
<tr><td>Date: </td></td><td><input type="text" name="date" value="<?php echo $row['date']; ?>"></td></tr>
<tr><td>Value: </td></td><td><input type="text" name="amount" value="<?php echo $row['amount']; ?>"></td></tr>
<tr><td>Catagory: </td></td><td><input type="text" name="donation_cat" value="<?php echo $row['donation_cat']; ?>"></td></tr>
<tr><td>Item: </td><td><input type="text" name="miscellaneous" value="<?php echo $row['miscellaneous']; ?>"></td></tr>
<tr><td>Note: </td><td><input type="text" name="note" value="<?php echo $row['note']; ?>"></td></tr>
</table>
<p style="margin-left:25px;"><input type="submit"></p>
</form>
Yes I know I'm using an older code version. Switching in the middle of this project will confuse me even further. Once everything is working I'll start learning the new stuff and rewrite the code and it will make more sense to me.
Thanks!