I think your case is a transaction; first figure out the solution to the problem in general, then consider whether a trigger is needed.
The table structure you have is a common pattern, in which the table has a foreign key to itself -- in this case prereqid is a reference to one or more other records in the same table. You are tracking courses, it seems, and one attribute of a course is that it may require that you take one or more other courses first.
Consider this important question: are prerequisites strictly hierarchical? For example, do you have to take CS 100 before taking CS 101, and CS 101 before taking CS 200? In this case, the prerequisites of CS 200 are 100, and 101 ... but (importantly) each course has only one prerequisite -- they form a chain. In this case, you don't need a trigger, because presumably the prerequisite of a course is known when you insert it's record.
In contrast, consider an econ course in econometrics, Econ 200, which requires both that you have taken Econ 100 and Math 102. This is the more likely scenario, and in this case your data model does not handle this case well, so that's the first thing to deal with.
In the second case, you have a relationship: one course has from zero to many prerequisites, and by thinking of it this way, you would model this as two tables: the course table that has information about term and year, and another that has has a foreign key to the courses table. Again, inserting into the courses table requires that you know 1) the information about the course, and 2) the courses that are its prerequisites.
If you captured this in one screen, to insert a new course, you would need to start a transaction. The first command would insert into the courses record, and (presumably) auto-generate the primary key of the course. Then, you would need to use the primary keys of each of the prerequisite courses and, for each insert a new row into the prerequisites table. When all of this was done, you would commit the transaction and all records would be written. In this case, you could do this as a stored procedure (in this case perhaps a trigger), or just as a transaction in program code.
I suspect you'll look at this and say, "yeah, but I just need to figure out how to write a trigger in PostgreSQL". The easy part is the CREATE TRIGGER command; the hard part is the CREATE FUNCTION -- that's where you'll need to decide how to implement it, and where you would decide that this must be an atomic transaction, and some other stuff. Ask a more specific question when you get there.