This topic is locked
[SOLVED]

 Redirect

3/27/2013 1:05:55 AM
PHPRunner General questions
K
KennyB author

I have a Custom Button on my View page (employee master file)
Pressing the button I am trying to redirect to a different file View screen.
I have no problem redirecting to the files list and filtering for the 1 record I want to see. But I cannot redirect directly to the VIEW screen.
here is what I have it is in the Client Before event of the button. Note I comment out the lines i dont want.

$_SESSION["myemp"] = saved user defined session variable that I use in other areas to filter just fine.
Redirect to List page works but not what I want: location.href = 'FDSPEK_list.php';

Redirect to View page DOES NOT WORK No message just stays on the current view page: location.href = 'FDSPEK_view.php?editid1='.$_SESSION["myemp"];
Also tried $str = "FDSPEK_view.php?editid1=" & $_SESSION["myemp"];
location.href = $str;
I did get a successful redirect when I HARD CODED the empl# into the line: location.href = 'FDSPEK_view.php?editid1=13';
So I am thinking maybe something to do with the Session variable not being able to be used in this event?

C
cgphp 3/27/2013

You are mixing js code and PHP code. In the "Client before" and "Client after" tabs you can add only js code. In the "Server" tab you can only add PHP code

T
Tempus_Erus 3/27/2013



You are mixing js code and PHP code. In the "Client before" and "Client after" tabs you can add only js code. In the "Server" tab you can only add PHP code


Hi Kenny,
Not sure if this would work but worth a try..... add the following in the server tab:
$result["txt"] = $_SESSION["myemp"];
Then in the client after tab
location.href = 'FDSPEK_view.php?editid1='+result["txt"];
if not you could get the current $keys for the record?
A

K
KennyB author 3/28/2013



Hi Kenny,
Not sure if this would work but worth a try..... add the following in the server tab:
$result["txt"] = $_SESSION["myemp"];
Then in the client after tab
location.href = 'FDSPEK_view.php?editid1='+result["txt"];
if not you could get the current $keys for the record?
A


Tempus Erus,
Thank you very much!!! Worked like a charm. exactly what I was tryign to do.