This topic is locked
[SOLVED]

 Passing Data to another view page through button

8/16/2012 2:28:31 AM
PHPRunner General questions
T
Tayyab Ilyas author

Using PHPRunner 6.1

I have a view page for jobs where users see the job description, now i have created a button "Apply This Job"

I wants to redirect to Application Page where users will input their data and cv. On application page i wants to have Job_ID (key for jobs table) and Job Title to be passed from previous page or to be filled automatically once the user hit the button.

Note My application is open to guest as well.

Please support how can I achieve this.

Thanks & Best Regards,

T
Tayyab Ilyas author 8/16/2012
C
cgphp 8/16/2012

You can get inspiration from that code. Redirection from a button requires JS code in the "Client after" event:

location.href = "http://.........";;
T
Tayyab Ilyas author 8/16/2012

Dear Cristian,

Thanks for your quick support, I have done exactly same and i reached to detailed page now how can i get value from url to fill my master key field
sorry to bother you, I am new to php and phprunner.
below is the string i am getting in address bar
http://localhost/mjobs/Job_Application_add.php?mastertable=jobs&masterkey1=1



You can get inspiration from that code. Redirection from a button requires JS code in the "Client after" event:

location.href = "http://.........";;


C
cgphp 8/16/2012

You can assign values to the add page fields in the "Process record values" event of the add page:



if(isset($_GET['masterkey1']) && !empty($_GET['masterkey1']))

{

$values['field_name'] = $_GET['masterkey1'];

}


Replace field_name with the actual name of the field on the add page.

T
Tayyab Ilyas author 8/16/2012

Thanks Cristian,
I have reached filled Job ID field with your support.

Now i have another question i also wants to automatically populate JobTitle field which is also in master table "Jobs"
Regards



You can assign values to the add page fields in the "Process record values" event of the add page:



if(isset($_GET['masterkey1']) && !empty($_GET['masterkey1']))

{

$values['field_name'] = $_GET['masterkey1'];

}


Replace field_name with the actual name of the field on the add page.

T
Tayyab Ilyas author 8/17/2012

Dear Cristian,
can you please guide me what is the error in query syntax as I am getting query syntax error


global $dal;

$tblOrders = $dal->Table('jobs');

$rs = $tblOrders->Query("Job_ID=".$values['Job_ID'],"");

if ($data = db_fetch_array($rs))

{

$values['Job_Title']=$data["Job_Title"];

}




Thanks Cristian,
I have reached filled Job ID field with your support.

Now i have another question i also wants to automatically populate JobTitle field which is also in master table "Jobs"
Regards

C
cgphp 8/17/2012
global $dal;

$tblOrders = $dal->Table('jobs');

$rs = $tblOrders->Query("Job_ID=".$values['Job_ID']);

if ($data = db_fetch_array($rs))

{

$values['Job_Title']=$data['Job_Title'];

}
T
Tayyab Ilyas author 8/18/2012

I am still getting this error

php error happened

Technical information

Error type 256

Error description You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

URL localhost/mjobs/Job_Application_add.php?

Error file C:\xampp\htdocs\mjobs\include\dbconnection.my.mysqli.php

Error line 42

SQL query select * from jobs where Job_ID=



global $dal;

$tblOrders = $dal->Table('jobs');

$rs = $tblOrders->Query("Job_ID=".$values['Job_ID']);

if ($data = db_fetch_array($rs))

{

$values['Job_Title']=$data['Job_Title'];

}


T
Tayyab Ilyas author 8/18/2012

Thanks Cristian for your support. The issue is solved. Error was because the value of Job_ID was null so i added an if statement.
Thanks for your support.



I am still getting this error