You're missing quotes around your id in
document.getElementById(delStaff".$i.").submit()
But the root problem is that you're abusing echo
which makes it hard to deal with quotes. Supposing you want to insert quotes here, you would have to escape them :
echo "<a href = '#' onclick='document.getElementById(\"delStaff".$i."\").submit()'/>Delete</a>";
Instead of
echo "<a href = '#' onclick='document.getElementById(delStaff".$i.").submit()'/>Delete</a>";
echo "</div>";
you should have
<a href='#' onclick="document.getElementById('delStaff<?php echo $i;?>').submit()"/>Delete</a>
</div>
And of course, proper separation of the javascript and the html would be even better.