This topic is locked

add form with info from other table

3/2/2011 10:51:14 AM
PHPRunner General questions
T
tedwilder author

Hello
I can't find in the help file how I can do the split form in 2 .

here is what I have : order table that contains customers id, and a table containing customers name.

I created a "cancel order " table. I need to be able to see on the drop down box on add form of cancel order form, in the drop down : all the number orders (descending ) and the name of the customer close to it.

how can I do that? sure there is a " custom expression " on the display field in lookup table, but what could I enter here? because it's a double request : get the customer id from order table then get the name and first name based on this id from the customer table...

thank you.

T
tedwilder author 3/2/2011

So I tried another but with no luck :

I tried to autofill the name of the user when number of order is selected.

so in my lookup ordernumber field I selected "autofill" and choosed that field " customer name " is autofilled with iduser from table order.

It actually work the id is filled.. but I need the name not the id.. so for field name I choosed: read only and under viex as: custom : I put :

$sql = "SELECT FROM user WHERE iduser =".$data["iduser"];

$rs = CustomQuery($sql);

$datauser = db_fetch_array($rs);

$value= $datauser["nom"]." " .$datauser["prenom"];
however now I get this php error when I try to lauch the cancel add form

"SELECT
FROM user WHERE iduser = "

it's like the value that the autofill function puts in the field customer name is not loaded in the array $data.. so $data["iduser"] is empty..

any solution?
thank you.