I am creating a database front end that will populate a table with the records in a the db, putting all values into input boxes so that they can be changed. I want to be able to make changes and have it update just that specific record. This is what I currently have.
{
if($row["order_number"]===NULL)
{
$on='<input type="number" name="orderNo" />';
} else {$on='<input type="number" name="orderNo" value="'. $row["order_number"] . '" />';}
if($row["name"]===NULL)
{
$cn='<input type="text" name="cusName" />';
}else {$cn='<input type="text" name="cusName" value="'. $row["name"] . '" />';}
if($row["product_type"]===NULL)
{
$pt='<input type="text" name="prodType" />';
} else {$pt='<input type="text" name="prodType" value="'. $row["product_type"] . '" />';}
$id='<input type="number" name="orderID" value="'.$row["order_id"].'"/>';
$tableCode.='<tr><td>' . $on . '</td><td>' . $cn . '</td><td>' . $pt . '</td><td><input type="submit" value="Update" name="'. $row["order_id"]. '" /></td><td hidden>'.$id.'</td></tr>';
}
This code is looped for all results in the table. samples.html.php simply sticks the results in some table tags on a webpage, along with the headers. The order_id is the primary key of the table (actually 2 tables, but I know how to handle that side of it)
Any help in this would be appreciated! Thanks!