How to hide the form after successful php execution

If I understand the code correctly, you are wanting to make the result_display() function call conditional by moving the post check to inside the shortcode function. ie.

function display_shortcode() {
    ob_start();
    if (isset($_POST['submit'])) {result_display();}
    else {html_form_code();}
    return ob_get_clean();
}