$query = "INSERT INTO \"survey1\" ( \"IDNO\" , \"IPA\" , \"VOTE\" ) VALUES (NULL , ".$domain.", ".$casted.");";
could be:
$query = 'INSERT INTO survey1 (IDNO, IPA, VOTE) VALUES (0, \'' . htmlspecialchars($domain) . '\', \'' . htmlspecialchars($casted) . '\')';
EDIT: Note that I use all...