What is the best practice for passing selected dropdown values in PHP through a URL?

When passing selected dropdown values in PHP through a URL, it's important to properly encode the values to prevent any issues with special characters or spaces. One common method is to use the `urlencode()` function to encode the values before appending them to the URL. This ensures that the values are passed correctly and can be easily decoded on the receiving end.

// Assuming you have a form with a dropdown menu named 'dropdown'
$selectedValue = $_POST['dropdown']; // Get the selected dropdown value

// Encode the selected value
$encodedValue = urlencode($selectedValue);

// Append the encoded value to the URL
$url = "https://example.com/page.php?selected_value=" . $encodedValue;

// Redirect to the URL
header("Location: $url");