Change your trigger on line 71 from:
if (isset($_POST["submit-consent-s"]) || isset($_POST["submit-consent-s_x"])) {
to:
if (isset($_POST["submit-consent-s"]) && $rsConsLeaseholders->getColumnVal("total_flats")) <= 10) {
That should do what you want... Let me know if you need any more assistance.