That sounds like programming type stuff to me, which (to my knowledge) Illustrator doesn’t do. However, there may be a way to do this in InDesign (another Adobe product), since it is oriented towards designing pamphlets, newspapers, and other type things. If you have access to that program, I might suggest trying that out instead.