Ok so I have two buttons in a form. One is to modify text and one is to delete the photo. My problem is that I only want one to be read. Here is the code I tried:
Now this doesn't work because both buttons are being posted obviously. Any quick ways to fix this? All help is appreciated.Code:if(isset($_POST['edit'])) { $sql = "UPDATE pictures SET pictext = '".$_POST['pictext']."' WHERE id = '".$_POST['id']."'"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } else { echo "1 record updated"; } } else if(isset($_POST['delete'])); { $sql = "DELETE FROM pictures WHERE id = '".$_POST['id']."'"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } else { echo "1 record deleted"; } }



Reply With Quote

Bookmarks