In my html I currently have:
<input type="hidden" name="redirect" value="example.com" />
Is it possible to change the value to redirect to the current page (basically refreshing the page) without having to manually put the url in for each page?
In my html I currently have:
<input type="hidden" name="redirect" value="example.com" />
Is it possible to change the value to redirect to the current page (basically refreshing the page) without having to manually put the url in for each page?
Yes, you could add this function to your code. I use it in some of my application
create a function like :
function getPageUrlNoQuery()
{
$pageUrl = ($_SERVER['PHP_SELF']);
return $pageUrl;
}
include the function file, and call.
<input type="hidden" name="redirect" value="<?php echo getPageUrlNoQuery() ?>" />
Have edited, and i think this should work in most architecture as long as you can call the function, or class. whichever you use.
Well, in PHP you should know what page you are loading anyways and then put that value in. (I don't know your architecture, but either set a variable in your controller manually or if you don't use Controllers, then simply extract the URL from the get request.)
Alternatively you can use Javascript:
document.getElementById('YourLink').value = window.location.href;