What potential issue can arise when using Fast Route with HTML forms in PHP?

When using Fast Route with HTML forms in PHP, an issue that can arise is that the form action URL may not match the actual route defined in Fast Route, leading to errors when submitting the form. To solve this issue, you can use the `url_for` function provided by Fast Route to generate the correct URL for the form action.

<?php
require_once 'vendor/autoload.php';

use FastRoute\RouteCollector;
use function FastRoute\simpleDispatcher;

$dispatcher = simpleDispatcher(function(RouteCollector $r) {
    $r->addRoute('GET', '/user/{id:\d+}', 'get_user_handler');
});

function url_for($routeName, $params = []) {
    global $dispatcher;
    return $dispatcher->routeParser()->urlFor($routeName, $params);
}
?>

<form action="<?php echo url_for('get_user_handler', ['id' => 123]); ?>" method="POST">
    <!-- form fields here -->
</form>