If the code entered in the input is correct, redirect to a link

Hello. Since there is no coupon creation in the plans section, I thought I could do this with a code. But I’m new to coding. Could you help?
After clicking the I have a coupon button, a page comes up before going to the discounted plan. There is an input place to enter coupons. If the code entered there is correct, it goes to discounted plans. In other words, if the code entered in an input is correct, it will redirect to a new link. If, equal and to link.

But I can’t write right now because I don’t know the coding. Could you help? Thank you.