Insert PHP code via shortcode?

$current_user isn’t declared in the scope of that function. You’d want to modify the code to be more like this:

function get_form($atts) {
    $current_user = wp_get_current_user();
    return '<form method="post" action="">
            <input type="input" name="myinput" value=""></input>
            <input type="hidden" name="myvar" value="' . $current_user->ID . '">
            </form>';
}
add_shortcode('myshortcode', 'get_form');

error code: 523