First you have to display the selected data in a from with textfields which have a name and a value. For the value you use your variables from the select-query:
<form action="<?php echo $PHP_SELF; ?>" method="post">
<input type="text" name="city" value="<?php echo $city?>">
<input type="text" name="state" value="<?php echo $state?>">
<input type="text" name="zip" value="<?php echo $zip?>">
Somewhere on this form you should have a hidden field containing the id from the database.
<input type="hidden" name="id" value="<?php echo $id?>";
at the bottom of your page you can now add some buttons for doing actions like updating, deleting and creating a new value in your database:
<input type="submit" name="update" value="Update">
<input type="submit" name="delete" value="Delete">
<input type="submit" name="create" value="Create">
</form>
If someone now presses one of these buttons, then the script runs itself, and the actions which belong to the buttons are performed:
<?php
if ($update)
{
mysql_query("UPDATE tbl_somthing SET city = '$city', state = '$state', zip = '$zip' WHERE id = '$id' ");
}
if ($delete)
{
mysql_query ("delete from tbl_something where id = ('$id')");
}
if ($create)
{
mysql_query("INSERT INTO tbl_something (city,state,zip) VALUES ('$city,'$state','$zip')");
}
?>