This topic is locked

Pass variables from detail to add page

9/14/2008 10:11:59 PM
PHPRunner General questions
U
Urnso author

[codebox]global $conn,$strTableName;

if ($_SESSION[$strTableName."_masterkey1"])

{

$sql = "select Legacy, Branches, Description, Size, Customer from runhistory where JDE=".$_SESSION[$strTableName."_masterkey1"];

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

$_SESSION["Legacy"] = $data["Legacy"];

$_SESSION["Branches"] = $data["Branches"];

$_SESSION["Description"] = $data["Description"];

$_SESSION["Size"] = $data["Size"];

$_SESSION["Customer"] = $data["Customer"];

}[/codebox]
I am using this code to auto fill my fields when a user clicks add while in detail view of the record. You have to refresh the page to get them filled. Also after you refresh and add the record those fields are autofilled everytime a user clicks add.
Do I need to unset those fields? How can I get around the refresh issue? Thx!

Sergey Kornilov admin 9/14/2008

What event do you use?

U
Urnso author 9/14/2008

I have tried it on Add Page> Add On Load and Add Page before display. Both with the same results. Have to refresh for fields to get populated.
Those fields are then populated everytime a users goes to the add page.

J
Jane 9/15/2008

Hi,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

U
Urnso author 9/15/2008

[codebox]global $conn,$strTableName;

if ($_SESSION[$strTableName."_masterkey1"])

{

$sql = "select Legacy, Branches, Description, Size, Customer from runhistory where JDE=".$_SESSION[$strTableName."_masterkey1"];

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

$smarty->assign("value_Legacy",$data["Legacy"]);

$smarty->assign("value_Description",$data["Description"]);

$smarty->assign("value_Size",$data["Size"]);

$smarty->assign("value_Customer",$data["Customer"]);

}[/codebox]
Works perfectly thank you!!