This topic is locked

Save button to redirect to another page.

2/4/2009 11:14:01 AM
PHPRunner General questions
S
swanside author

I have the following tables Job, Risk, Test, Complete.
I have set up Risk to be a child of Job linking both by Job_No.

I have set up Test to be a child of Risk linking both by Job_No.

I have set up Complete to be a child of Test linking both by Job_No.
When I click on Job I have a link for Risk. I click on Risk and proceed to Add new and enter the details, WHen I save the details in Risk and press Back To List, it shows me the details I have entered plus the link now for the Test. I do the same in this by pressing Add new and enter the details, press save and back to list and now I see the link for Complete.
What I want to do is from the Risk Add new page, press save and have it take me to either the Add new page on Test, or to the Test list page where I can press the Add new button.
ANy help please?
CHeers
Paul.
PS I have this in my address bar
Risk_list.php?mastertable=risk%5Fassess&masterkey1=1000003

J
Jane 2/5/2009

Paul,
use After record added event to redirect to another page.

Here is just a sample:

global $strTableName;

header("Location: Test_list.php?mastertable=Risk&masterkey1=".$_SESSIOB[$strTableName."_masterkey1"]);

exit();

S
swanside author 2/5/2009

Paul,

use After record added event to redirect to another page.

Here is just a sample:


Thanks Jane.
I got an error so I changed the SESSIOB to SESSION, but now when I press save, it takes me to the Test_list.php page but it does not show the correct masterkey,

i.e the correct list page would be something like this in the address bar,
/appliance_list.php?mastertable=risk%5Fassess&masterkey1=1000003
But when I run it I get
/appliance_list.php?mastertable=risk_assess&masterkey1=
It doesnt take me to the Job_ID of 1000003 or what ever the other jobs are?
Thanks

Paul.

J
Jane 2/6/2009

Hi,
sorry for my fault.

Here is the correct code:

header("Location: Test_list.php?mastertable=Risk&masterkey1=".$_SESSION["DetailTableName_masterkey1"]);

exit();



where DetailTableName si your actual table name.

S
swanside author 2/7/2009

Thanks Jane, that works a treat.
But,
Instead or going to the list page when the save button is pressed, is it possible to go straight to the add new page for the same masterkey?
Thanks

Paul.

J
Jane 2/9/2009

Paul,
yes. It's possible.

You just need to check passed masterkey in the Add page: Before process event and fill session variables manually.

S
swanside author 2/9/2009

Sorry Jane, I dont know what you mean.
What I have is.
My main table is Jobs, I have a child table to that called job_sheet. SO in the job_lists.php page I have a link on the left for Job Sheet. I click on this link and up comes the list page. I click on Add new and fill in mt details. Once it is saved I press back to list and there is the info I have entered, plus a new link now which will take me to risk_assess. I click on this link and then I get risk_assess_list.php, then I click on Add new.
What I am after doing is from my job_list.php is click on the Job Sheet link, click on Add new and put in the details, then click on save and up comes the risk_assess_add.php page, which are all linked onto each other using the Job_No as the key.
I put in this code

header("Location: risk_assess_add.php?mastertable=job_sheet&masterkey1=".$_SESSION["job_sheet_masterkey1"]);

exit();


and when I click on Add new on job_sheet_list.php it takes me to the add new page for risk_assess?
If I put it in Add Page - After record Added, it takes me to the correct page but It does not bring over my Job_No?
Cheers

Paul