What I've done in the past, especially if the requirement is to have the input boxes on the same page as the records, is to display the input boxes at the top of the page in their own form.
Then, underneath the input boxes list the records available for amendments. At the end of each row is a button, which once pressed, will insert the correct variable into the correct input box. I've usually used JavaScript for this, because I found it quite easy to use.
Clear as mud ... here's an example. A table has 4 attributes:
CREATE TABLE `tblPeople` (
`peopleID` INT( 12 ) NOT NULL AUTO_INCREMENT,
`firstName` VARCHAR( 30 ) ,
`lastName` VARCHAR( 30 ) ,
`ageYears` INT( 12 ) DEFAULT '0' NOT NULL ,
PRIMARY KEY ( `peopleID` )
);
Now you've got the table, here's the PHP/HTML code to view and amend the records:
<?php
// This is just to connect to the database - you can create your own function or use the mysql_connect() function
include_once("dbc.inc");
$db = db_connect();
?>
<html>
<head><title>Test Screen</title>
<SCRIPT LANGUAGE="JavaScript">
function add_amend() {
// You can include any error checking on the input fields here
frmPeople.submit();
}
function amend_record(strPeopleID, strFirstName, strLastName, strAgeYears) {
frmPeople.peopleID.value = strPeopleID;
frmPeople.firstName.value = strFirstName;
frmPeople.lastName.value = strLastName;
frmPeople.ageYears.value = strAgeYears;
}
</SCRIPT>
</head>
<body>
<table border=0 cellspacing=0 cellpadding=0 align=center STYLE="width: 400px;">
<tr><td STYLE="width: 100px; font-size: 12px; font-weight: 700;">ID Number</td><td STYLE="width: 100px; font-size: 12px; font-weight: 700;">First Name</td><td STYLE="width: 100px; font-size: 12px; font-weight: 700;">Last Name</td><td STYLE="width: 100px; font-size: 12px; font-weight: 700;">Age (Years)</td><td STYLE="font-size: 12px; font-weight: 700;">Add/Amend</td></tr>
<form name="frmPeople" action="test_screen_amend.php" method=POST>
<tr><td><input type="text" name="peopleID" value="" size=5 maxlength=6></td><td><input type="text" name="firstName" value="" size=25 maxlength=30></td><td><input type="text" name="lastName" value="" size=25 maxlength=30></td><td><input type="text" name="ageYears" value="" size=5 maxlength=6></td><td><input type="button" name="btnAddAmend" value="" STYLE="width: 15px; height: 15px; color: #FFFFFF; background: #009900;" onClick="add_amend()"></td></tr></form>
<?php
$qry = "SELECT * FROM test.tblPeople ORDER BY peopleID";
$res = mysql_query($qry, $db);
for ($i=0; $i < mysql_num_rows($res); $i++) {
$row = mysql_fetch_array($res);
?>
<tr><td><?php echo $row["peopleID"]; ?></td><td><?php echo $row["firstName"]; ?></td><td><?php echo $row["lastName"]; ?></td><td><?php echo $row["ageYears"]; ?></td><td><input type="button" name="btnAmend" value="" STYLE="width: 15px; height: 15px; color: #FFFFFF; background: #009900;" onClick="amend_record('<?php echo $row["peopleID"]; ?>','<?php echo $row["firstName"]; ?>','<?php echo $row["lastName"]; ?>','<?php echo $row["ageYears"]; ?>')"></td></tr>
<?php
}
?>
</table>
</body>
</html>
The form points to a second PHP page - this is where you can create your MySQL queries to amend the data, or if the 'peopleID' input box is blank, you could create a new record.
Hope this gives you some ideas to be getting on with!