to the update query the $id could not passed.
tathe content ID to a hidden field in your form, and if you click on the update button,
add value to $id variable: $id=$_POST["id"]
And in this IF condion: ($_POST["$submit"])
do not use that $submit variable, just use $_POST["submit"]
//If cmd has not been initialized
if(!isset($cmd))
If this cmd variable got a value from a link or form, use $POST os $GET superglobal in this condition. This line remindes me the REGISTER globals directive problem.