hi again what do i need to populate a form from database and view each record and amend or delete it cheers Doug
Just create an action flag for the submit button and switch it in the IF POST. if($_POST){ $id = $_POST['id']; $item1 = $_POST['item1']; $item2 = $_POST['item2']; $item3 = $_POST['item3']; mysql_query("UPDATE <TABLE> SET item1 = '" . $item1 . "', item2 = '" . $item2 . "', item3 = '" . $item3 . "' WHERE id = '" . $id . "'"); } print "<table>"; $result = mysql_query("SELECT * FROM <TABLE>"); while($row = mysql_fetch_array($result)){ print "<form> <input type='hidden' name='id' value='" . $row['id'] . "' /><tr> <td>Item 1 : <input name='item1' type='text' value='" . $row['item1'] . "' /></td> <td>Item 2 : <input name='item2' type='text' value='" . $row['item2'] . "' /></td> <td>Item 3 : <input name='item3' type='text' value='" . $row['item3'] . "' /></td> <td><input type='submit' value='edit' /></td> </tr></form>"; } print "</table>"; PHP:
sorry not sure what to do with this code as i have very little know how as i am still learning cheers Doug
No problem Doug. I'd suggest you learn the basics of PHP before you start using databases. www.php.net