WordPress 4.8.1 php getting commented

As I mentioned in the comments, you should not and also can not use codes inside your content. Any code tags that you use will be escaped.

Instead, define a shortcode in your theme’s functions.php file and use that inside your content. Let’s create a simple shortcode together:

function create_shortcode( $atts ) {
    // Create a default value for the attributes
    $atts = shortcode_atts( 
        array(
            'parameter' => 'default value',
        ), 
        $atts, 
        'my-shortcode' 
    );

    // Add your functions here and return the value.
    // The value can be anything, including a full
    // HTML code or a form.
    return "value = {$atts['paremeter']}";
}
add_shortcode( 'my-shortcode', 'create_shortcode' );

Now, by using [my-shortcode parameter="sample"] in your content you can output value = sample. Replace the code inside the shortcode with whatever you desire, which in your case is a HTML form.