<form action="" method="post"> <table> <tr> <?php if (isset($_GET['id'])) { ?> <td>ID:</td> <td><input readonly="readonly" value="<?php echo $_GET['id']; ?> "></td> <?php $row = escape($_GET['id']); $query = "SELECT * FROM inventory WHERE id = " . $row; $status = new DBlink(); $res = $status->set($status->conn(), $query); while ($r = mysqli_fetch_assoc($res)) { $_POST['iName'] = $r['itemName']; $_POST['desc'] = $r['description']; $_POST['sCode'] = $r['supplierCode']; $_POST['cost'] = $r['cost']; $_POST['sPrice'] = $r['price']; $_POST['noHand'] = $r['onHand']; $_POST['rPnt'] = $r['reorderPoint']; if ($r['backOrder'] == 'y') { $_POST['obOrd'] = $r['backOrder']; } } } ?> </tr>
function escape($string) { $link = new DBlink(); return mysqli_real_escape_string($link->conn(), $string); }