Firstly, thanks so much “Smokey PHP” for taking the time to give me such a detailed response. Much appreciated.
I have implemented the change by trying the function in the section and in the body of my PHP file in a PHP wrapper (made small changes in reduceing the number of equals signs in two places, which I think were typos).
<?php
function redirect($location,$delay=0)
{
if(headers_sent() == true && $delay <= 0)
{
header("Location: ".$location);
echo 'alert('.$location.')';
}
else
{
echo $delay = 0 ? ''
: '';
echo '';
}
}
?>
I have added the echo ‘alert(’.$location.’)’; statement to make sure I am getting to where I need to and it is working. I am passing the location http://www.ibm.com.
The outcome is that the file is displaying:
alert(http://www.ibm.com/)
but not redirecting to http://www.ibm.com/
Sorry for maybe being so stupid, but I am stuck.