This topic is locked

Redirect to add page after save button pressed

2/15/2009 1:50:34 PM
PHPRunner General questions
S
swanside author

I have put this in to Events>Add Page>After Record Added

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

exit();


My Tables are linked by Job_No.
I Got to Add new on my Job Sheet enter the info and press save, it then takes me to the Add New page for risk assess but my Job_No field is blank.
If I go to the Job Sheet list and click on the link for Risk Assess and then click on Add New, my Job_No field is carried over to the correct field.
I have the two tables linked by Job_No.
Any help please?

Thanks

Paul.

J
Jane 2/16/2009

Hi,
you need to fill session variables for current table in the Add page: Before process event.

S
swanside author 2/16/2009

Hi,

you need to fill session variables for current table in the Add page: Before process event.


Sorry, DOnt quite understand what seeion variables I need to add in the page?

J
Jane 2/17/2009

Paul,
$_SESSION["risk_assess_masterkey1"] is empty if Job_No field is blank.

You need to check passed value in the Add page: Before process event and fill this variable manually.

Here is just a sample:

if (@$_REQUEST["masterkey1"])

$_SESSION["risk_assess_masterkey1"] = $_REQUEST["masterkey1"];

S
swanside author 2/17/2009

Hi Jane,
Sorry, but I am really having problems with this.
On my job_sheet page in the events>Add Page>After Record Added I have this.

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

exit();


So if I click on Add new on Job_Sheet_List for Job_No 1000014 and enter the information, click save

This takes me to this URL

http://localhost/Sheet/risk_assess_add.php...terkey1=1000014


As you can see, it shows the master key 1000014 is still in the address bar, but it is not in my Job_No field.

So, On the risk_assess> events>Add Page>Add before process I have this

if (@$_REQUEST["masterkey1"])

$_SESSION["risk_assess_masterkey1"] = $_REQUEST["masterkey1"];



I Still get the Job_No field empty.
In the Datasource Tables, I have job_sheet as my master and risk_assess as my child, both linked with Job_No.

In visual editor, I have the Job-No field on the add page set up as a Text Field, But, I can not get the number i.e. 1000014 in the Job_No field on the add page for the risk assess.
Can you see where I am going wrong please?

Thanks

Paul.

J
Jane 2/18/2009

Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.