Really, the answer by @jaswrks will work, if you are using a shortcode to run code via an edited page.
But, this is back to front way of using PHP.. and you are so close to learning how to really write PHP inside WordPress, instead of via a proxy like a shortcode that allows you to write quasi-PHP in the editor..
So, what you could also try, is to edit the page template where the form appears ( or add via widgets, blocks, external functions or any of the other means available ) and add the following:
// get current user ID, with default value, if empty
$current_user_id = wp_get_current_user_id() ?? 0;
<input type="hidden" name="id" value="<?php echo esc_attr( $current_user_id ); ?>">