(730 ILCS 5/5-4-2) (from Ch. 38, par. 1005-4-2)
    Sec. 5-4-2. Multiple Offenses.
    (a) After conviction and before sentencing, the defendant shall be permitted, subject to the approval of the State's Attorney, to plead guilty to other offenses he has committed which are within the same county. If the defendant is not formally charged with such offenses, an information shall be filed on the basis of the defendant's admission of guilt. Submission of such a plea shall constitute a waiver of all objections which the defendant might otherwise have to the charge. If such a plea is tendered and accepted, the court shall sentence the defendant for all offenses in one hearing under Section 5-8-4.
    (b) A defendant convicted, charged, or held in custody in a county other than that in which any other charge is pending against him may state in writing or in court that he desires to plead guilty, to waive trial in the county in which the charge is pending and to consent to disposition of the case in the county in which he is held, convicted or charged, subject to the approval of the state's attorney for each county. Upon receiving notification from the sentencing court, the clerk of the court in which the charge is pending shall transmit the papers in the proceeding or certified copies thereof to the clerk of the court in which the defendant desires to plead guilty. Thereafter, the prosecution shall continue in that county. If after the proceeding has been transferred, the defendant pleads not guilty, the proceeding shall be restored to the docket of the court where the charge was pending.
(Source: P.A. 77-2097.)