conditionals to show next row of input causing page to crash