The law, passed on Thursday, requires schools to get written parental consent before giving sex or relationship education.