So in the past, it seems like I've always used PHP_SELF as the action of a form. This seems to work fine for me, but I'm always curious for the "best way" to do stuff. I thought about using REQUEST_URI, but I didn't see any advantage, and the best I can tell, that env variable doesn't exist in the CLI, so it may be unreliable.

I also thought of writing a small function and tucking it away like so:
PHP Code:
if (isset($_SERVER['REQUEST_URI'])) $uri .= $_SERVER['REQUEST_URI'];
$uri .= $_SERVER['PHP_SELF'] . ((!empty($_SERVER['QUERY_STRING'])) ? '?' $_SERVER['QUERY_STRING'] : '');

But I'm basically just using the env variables, so not much is gained I guess.

Any input or thoughts? I don't have a framework available, so I'm hoping for a short, sweet, pure php idea.