Results 1 to 5 of 5
Apr 3, 2009, 11:09 #1
- Join Date
- Dec 2005
- 0 Post(s)
- 0 Thread(s)
Form Action: PHP_SELF, REQUEST_URI or what?
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:
if (isset($_SERVER['REQUEST_URI'])) $uri .= $_SERVER['REQUEST_URI'];
else $uri .= $_SERVER['PHP_SELF'] . ((!empty($_SERVER['QUERY_STRING'])) ? '?' . $_SERVER['QUERY_STRING'] : '');
Any input or thoughts? I don't have a framework available, so I'm hoping for a short, sweet, pure php idea.MySQL v5.1.58