The link below is being used to call a function that is in the prescription.class.php file. This also uses smarty.
<a id="ReIssueRx" href="{$CONTROLLER}prescription&ReIssueRx" class="css_button"><span>{xl t='Re-Issue'} ({xl t='Rx'})</span></a>
The function / method runs a sql script and finishes its job.
function ReIssueRx(){
sqlStatement( Do function to completion);
return;
}
The problem for me is that I want it to return to the original page where the link is located. I have tried Location:"backtourl.com" and refresh:"backtopage.com" but neither of these work. I have just tried at the end return 'linktopage.php'; and that just returns the words.
Is there a way to auto redirect out of a function back to a page or back to the calling page?
Thanks!
You could use the $_SERVER['HTTP_REFERER']
function to get the previous URL, store it in a variable and after your code execution is done you can use header('location')
to return to the calling page.
like this:
$prev_page = $_SERVER['HTTP_REFERER'];
function ReIssueRx(){
sqlStatement( Do function to completion);
header('location:' . $prev_page);
}
Goodluck!