Passing a value from an input field to a php function in WordPress?

If you add handler for action with add_action, you should call this with do_action, but I does not see it. Also actions using in AJAX, simple POST/GET request is not need of

Simple example of form handling

<form method="POST" action="" class="my-form">
    <input type="hidden" name="category" value="" />
    <input type="hidden" name="action" value="recipe_filter" value="123" />
    <input type="submit" />
</form>

// PHP somewhere like functions.php or this page exactly

<?php
if( ($_POST['action'] ?? '') == 'recipe_filter' ){
 $value = empty($POST['category']) ? 'default value for category' : $POST['some'];
}

?>

JS

run $('form.my-form').submit() when dropdown value is changed