broserdooder broserdooder - 1 year ago 87
HTML Question

php mysql refresh dynamic page after form submit

i'm trying to figure out how to refresh a page after a form is submitted which updates a column in my db ... the user pushes a button in a notification area and it updates the sql db ... as this area is located site wide, i don't want to send them to a specific page as they might not be on that page ... since all of the pages are dynamically generated, using $_SERVER[PHP_SELF] responds with .com/page.php rather than .com/page.php?user_id=1.

is there a way to get refresh with the dynamic page extension? as always, any and all help is greatly appreciated!! thanks!!

Answer Source

You can use $_SERVER['REQUEST_URI'] instead of $_SERVER[PHP_SELF]

For example:

$url =  "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";

Will return the full url path, Not just the self script path.