How to use a dropdown to filter posts by custom field

A full, working-code style answer is a bit out of scope here, but here are some suggestions for your two questions:

  1. Custom fields are saved as postmeta. So you’ll want to set up a simple form with one text input and GET method. In your PHP to process the form, check whether your $_GET variable is set. If not, display the empty form. If so, use a WP_Query to find all posts with the given parameters. Here’s an excellent answer that shows how to do a greater-than-or-equal-to comparison on postmeta.

  2. The code from your second link only works within the Loop. The main query has already run by the time this code executes, so it appears to be meant to run only on an Archive which would already have a number of posts fetched from the database.