Antwon Boone ("Tenant") appeals from the judgment in favor of Bryant Cunningham ("Landlord") and his partner Victoria Jamerson on their petition for rent and possession. We affirm the judgment as modified herein.
Tenant and Landlord orally agreed that Tenant would rent a house from Landlord for $600 a month on a month-to-month basis. Tenant began living in the house and paying rent in September of 2015. On March 10, 2016, Landlord filed a rent and possession petition in the associate circuit division of the circuit court alleging that Tenant owed $600 in rent for the month of March. Tenant filed a responsive pleading denying that any rent was due. Tenant alleged that he was withholding rent until necessary repairs were made to the house. He asserted as an affirmative defense and counterclaim that Landlord breached the implied warranty of habitability by failing to provide a premises fit for human occupation due to a sewer problem. Tenant also asserted as an affirmative defense that the Landlord's petition was an attempt to enforce an illegal contract. Tenant alleged that the City of St. Louis condemned the property because Landlord never obtained a certificate of inspection permitting occupancy of the house.
The bench trial was held on April 8, 2016. Landlord testified that he was seeking unpaid rent for the months of February, March and April of 2016. Tenant testified that he paid rent in February, but admitted that he had not paid rent in March or April. Tenant was still in possession of the house at the time of trial. Tenant testified that he was withholding *902the rent until Landlord fixed the sewer and other problems. Landlord essentially agreed that these problems existed, but claimed he could not fix them because Tenant would not give him access to the property. Landlord admitted that he had received a letter from the City informing him the property had been condemned for lack of an occupancy permit. Landlord believed that Tenant was responsible for getting the occupancy permit. Landlord testified that he was also aware the property had health code violations. Tenant testified that he learned the home was condemned in February of 2016 and told Landlord in March that he would have to move out. The trial court asked Tenant why he was still living at a condemned property in April, and Tenant said he was waiting for his new place to be ready to move into. The trial court also asked "when you withheld that rent, did you put it aside in any type of bank or escrow account to prove to the court that but for the conditions, you would have paid [the rent]." Tenant said yes, but was unable to provide the court proof from a bank account or escrow account.
The trial court found that rent in the amount of $1800 was due and unpaid, presumably representing $600 for each of the months Landlord claimed at trial. It awarded Landlord possession of the property and denied Tenant's counterclaim. This appeal follows. This Court will affirm the judgment in a rent and possession case tried by the court "unless there is no substantial evidence to support it, it is against the weight of the evidence, or it erroneously declares or applies the law." K.O. Real Estate, LLC v. O'Toole , 291 S.W.3d 780, 788 (Mo. App. E.D. 2009).
In his first two points on appeal, Tenant claims the court erroneously declared and misapplied the law by requiring Tenant to show he escrowed the rent in order to prevail on his affirmative defense and counterclaim for breach of the implied warranty of habitability. In his fourth point, Tenant contends the judgment was against the weight of the evidence because he proved all the required elements of this defense and counterclaim. The Supreme Court's recent discussion on this issue in Kohner Properties, Inc. v. Johnson, 553 S.W.3d 280, 282, 2018 WL 3235686, *2 (Mo. banc July 3, 2018), dictates our result here.
In Kohner , the trial court barred the tenant from asserting an affirmative defense and counterclaim that the landlord had breached the implied warranty of habitability because the tenant failed to either vacate the premises or tender her rent to the court in custodia legis. Id. at 281, at *1. In doing so, the trial court relied on King v. Moorehead , 495 S.W.2d 65, 77 (Mo. App. 1973) and its pronouncement of an in custodia legis procedure in all rent and possession cases where the tenant remains in possession. The Supreme Court held this pronouncement was dicta. 553 S.W.3d at 283, 2018 WL 3235686 at *3. The Court noted that, nevertheless, our trial courts have been dutifully following that dicta "for almost five decades in the absence of contrary guidance from this Court or the Missouri General Assembly" and requiring withheld rent to be escrowed under King . Id. The Court in Kohner provided the guidance that had been absent since King , addressing squarely for the first time, the question of whether tenants in possession asserting a breach of the implied warranty of habitability are absolutely required in all cases to deposit rent payments with the trial court. Id. The Court examined how courts in other jurisdictions handle this issue and concluded that the majority of them leave the imposition of such a requirement to the sound discretion of the trial court. Id. at 283-86, at *3-5 (citing *903cases from the D.C. Circuit, California, Pennsylvania, Minnesota and New York).
The Court decided to do the same in our circuit courts: "Consistent with the prevailing view of a majority of jurisdictions, this Court holds circuit courts may exercise discretion on a case-by-case basis to determine whether an in custodia legis procedure is appropriate in a particular case." Id. at 285, at *5. Trial courts are in the best position to assess the merits of the parties' position and determine whether requiring rent to be escrowed is necessary to protect the landlord's economic interests without depriving the tenant the opportunity to raise the warranty of habitability issue. See id. Therefore, the Court held, "the circuit courts have the discretion to institute a suitable protective procedure upon either party's request and after notice and an opportunity to be heard by the opposing party." Id. at 286, at *6. But the Court did not reverse the trial court's ruling even though it relied on dicta from King :
King 's pronouncement of an in custodia legis procedure had been in place for almost five decades, and, therefore, constituted the status quo in Missouri. For this reason, and given the absence of contrary authority from this Court or contrary legislation from the General Assembly, the circuit court in this case cannot be faulted for relying on King when it barred [the tenant's] affirmative defense and counterclaim. Accordingly, it did not erroneously declare or apply the law at the time it entered its judgment.
Id. at 286-87, at *6-7.
The same result is required in this case for the same reason. Though not expressly stated as the basis for rejecting Tenant's counterclaim for breach of the implied warranty of habitability, it appears the trial court believed that Tenant's claim was untenable absent proof that he had set aside the rent money he was withholding. Like the Court in Kohner , we will not fault this trial court for following the status quo in Missouri. Thus, as in Kohner , we conclude that the trial court did not erroneously declare or apply the law as it was at the time this judgment was entered.
Points I, II and IV are denied.
In his third point, Tenant argues the trial court erroneously declared or misapplied the law in permitting Landlord to recover rent on property for which no certificate of inspection permitting occupancy had been obtained as required by a City of St. Louis ordinance. He claims that the agreement to pay rent on this condemned property is therefore illegal, void and cannot be enforced.
Contract provisions that violate the law, including municipal ordinances, are illegal and unenforceable. Rice v. James , 844 S.W.2d 64, 69 (Mo. App. E.D. 1992). The illegality of a lease, like any other contract, is an affirmative defense to a rent and possession action. See King , 495 S.W.2d at 78. It must be properly pled, including a "short and plain statement of the facts showing that the pleader is entitled to the defense." See Rule 55.08. Tenant pled that the contract was illegal and pled facts indicating that the house was condemned for lack of an occupancy permit. But nowhere did Tenant plead the facts necessary to show that attempting to enforce the rent obligation of the contract on property without an occupancy permit was illegal because it violated an ordinance.
Even if this affirmative defense had been sufficiently pled, it is not self-proving. See Brentmoor Place Residents Association v. Warren , 816 S.W.2d 7, 9 (Mo. App. E.D. 1991). Tenant, as the proponent of the defense, bore the burden of *904proving it at trial. See id. Tenant had to produce evidence that Landlord did not have the required certificate permitting occupancy at the time rent was being charged and evidence that such conduct was a violation of a law; then Tenant had to persuade the court to view the facts in a way favorable to his position. See generally White v. Director of Revenue , 321 S.W.3d 298, 305 (Mo. banc 2010) (defining components of burden of proof: burden of production and burden of persuasion).
Tenant contends the evidence at trial was undisputed that Landlord did not have the certificate permitting occupancy and was still charging rent. He claims in his brief that this was illegal under Ordinance 67914. Even assuming Tenant met his burden of proving that Landlord was attempting to collect rent when he did not have a certificate permitting occupancy, Tenant did not meet his burden of proving that this was illegal because, in addition to not being pled, Ordinance 67914 was not in evidence in the trial court. The only way for a court to determine the content of a municipal ordinance is for the ordinance itself to be placed in evidence or for the parties to have stipulated as to its elements. Rice v. James , 844 S.W.2d 64, 66 (Mo. App. E.D. 1992). The only place there is even reference to the ordinance in this trial record is in a letter attached to Tenant's responsive pleading, in which the City notified Landlord the property had been condemned for "failure to secure Certificate of Inspection" and cited Ordinance 67914. But that letter did not contain the text of the ordinance cited therein and, more importantly, was not offered into evidence at trial. "The mere filing of a document does not put it before the court as evidence," and the document cannot be considered by the court in making its judgment unless and until it is offered and admitted into evidence. Student Loan Marketing Association v. Holloway , 25 S.W.3d 699, 702 (Mo. App. W.D. 2000). Tenant has failed to plead and prove his affirmative defense of illegality of paying rent on this property under the parties' agreement and, therefore, the trial court did not err in enforcing that agreement.
Point III is denied.
Finally, in his fifth point on appeal, Tenant argues that including February rent in the judgment was error because Landlord only asked for March rent in the petition and therefore February was outside the scope of the pleadings. We agree.
[T]he open-ended nature of a rent and possession action allows a landlord to avoid filing successive petitions for amounts of rent due between the time of the filing of the initial petition and the date of judgment. Because it is unlikely that a landlord can predict when the case will be tried, the landlord may not know at the time the petition is filed the exact amount of rent due to the date of judgment. However, the same lack of knowledge is not present with respect to facts in existence as of the date the petition is filed. Accordingly, there is no rationale based on the relevant statutes that supports permitting [a landlord] to present evidence of rent due outside the time period pleaded, other than amounts that accrued during the pendency of the action.
The Medve Group v. Sombright , 163 S.W.3d 453, 458-59 (Mo. App. E.D. 2005). Even though Tenant did not object when Landlord requested February rent at trial-which might indicate he impliedly consented to trying that issue-there was no motion to amend the pleadings to conform to the evidence of February rent at trial. See id. (citing Rule 55.33(b) ); see also Terry v. Korn , 526 S.W.3d 130, 134 (Mo. App. W.D. 2017). Therefore, February rent *905was outside the pleadings, and the trial court was without authority to award that month's rent to Landlord. See The Medve Group , 163 S.W.3d at 459. Landlord is only entitled to recover rent for March and April of 2016, in the amount of $1200.
Point V is granted.
The amount of the judgment is modified to award $1200 in rent to Landlord, and, as modified, is affirmed.
Angela T. Quigless, P.J. and Lisa S. Van Amburg, J., concur.