A reasonable thought. What did your debug code show?
echo "Connection Working";
Incidentally, that would be really hard to figure out what is/isn't working, as written.
echo "Connection Working<br/>";
echo "grade: $TheGrade <br/>";
echo "name: $name <br/>"
echo "type: $type <br/>"
echo "size: $size <hr/>"
And you *REALLY* should follow the advice Fumigator gave you.
To wit: If the name and/or type fields in your DB is a string type (e.g., VARCHAR or CHAR) then you *MUST* have apostrophes around their values.
$query = "INSERT INTO " . $gradetable . " (name,type,size) "
. " VALUES ('" . $name . "','" . $type . "'," . $size . ")";