$GET['id'] will return the value of the 'id' parameter in the URL of the current page, if it exists. Otherwise, the array key won't even exist and your script will throw notices about undefined indexes. That's why I suggested testing the value of $GET['id'] and only executing the second MySQL query if it exists.
gmrstudios wrote:I also noticed that the submit $SERVER['PHP_SELF'] calls the page name but not the id.
As per the manual for $SERVER (see [man]variables.server]), $SERVER['PHP_SELF'] contains "the filename of the currently executing script, relative to the document root." So, if you're referring to something such as "http://mysite.com/foo.php?id=1", then yes, of course $SERVER['PHP_SELF'] would excuse the 'id' portion since it has nothing to do with the 'filename of the currently executing script.'
If you wanted to include the query string as well, you'd have to do something like:
$_SERVER['PHP_SELF'] . (!empty($_SERVER['QUERY_STRING']) ? "?$_SERVER[QUERY_STRING]" : '');
Also, forgot to mention this earlier: Your script is vulnerable to SQL injection attacks. User-supplied data should never be placed directly into a SQL query. Instead, you must first sanitize it with a function such as [man]mysql_real_escape_string/man.
Note that since the purpose of sanitization is to prevent unwanted data from entering the SQL query, there are other methods of data sanitization as well, depending upon the expected data type. For example, if $GET['id'] is expected to be an integer, all you would need to do in order to sanitize it would be to cast the data to an integer:
$id = (isset($_GET['id']) ? (int)$_GET['id'] : NULL); // you can use whatever you'd like for a default value