How to get the value of input hidden html from text editor to custom page template?

If you’re not specifying a page, then you would access the $_POST data on the same page as your form.

print_r( $_POST );

if ( isset( $_POST[ 'firstname' ] ) )
{
    echo $_POST[ 'firstname' ] . ' ' . $_POST[ 'lastname' ];

    wp_die();

}
else 
{ 
    ?>

    <form method="POST">

        First name:<br>
        <input type="text" name="firstname" value="Mickey"><br>

        Last name:<br>
        <input type="text" name="lastname" value="Mouse"><br><br>

        <input type="submit" value="Submit">

    </form>

    <?php 

    wp_die();
}

If you want to access $_POST data on another page, you would probably need to specify that in the action attribute.

<form method="POST" action="your_page_name_here.php">
    <input type="hidden" name="segment" value="test">
    <input type="submit" value="Submit">
</form>