Solution:
This is a bug which crops in when within the layout, you set the parent container's overflow property to “auto” and placing a relatively positioned item within it. This relatively positioned item tends to violate the parent element's boundaries and overflows. The simplest fix to this bug is to position the parent container relatively.
I improved usability by reducing it to one input text field and two buttons for two functionalities. On the front end I used "formaction" attribute in buttons instead of "action" attribute in the form. So I reduced everything into one form. In the backend, it was a bit more complicated. I needed to differentiate between different types of input and gather different classes of the two functionalities into one class. This helped remove code duplicates and made the code easier to understand. In the end, the usability of the web page improved greatly and the backend code was also improved.