This topic is locked

Link to different field than the displayed field

7/17/2008 7:42:37 AM
PHPRunner General questions
M
mnhuda author

Hello,
My order_list page has CustomerID field. I want to make a hyperlink to the CustomerID field so that when clicked on it, it opens details of that customer. My html code looks like following.
<A href="target=_blank customer_list.php?a='search&amp;value=1&amp;SearchFor={$row.1CustomerID_value}&amp;SearchOption=Contains&amp;SearchField=CustomerID">{$row.1CustomerID_value}</A>
Now I want to list ($CustomerName."/".$Area) instead of {$row.1CustomerID_value} on the order_list page -here $Area is a field in Customer Table. That is I want to display (Customer name, a slash and his/her area) instead of his/her ID and when clicked on it, a page with customer details will open (the hyperlink should work).
Can I do this?
Regards

J
Jane 7/17/2008

Hi,
use custom format on the "View as" settings dialog on the Visual Editor tab.

Here is a sample:

global $conn;

$str = "select CustomerName,Area from customer where CustomerID=".$value;

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

if ($data = db_fetch_array($rs))

{

$str = $data["CustomerName"]."/".$data["Area"];

$link = "<a target=_blank href=\"customer_list.php?a=search&amp;value=1&amp;SearchFor=".$value."&amp;SearchOption=Contains&amp;SearchField=CustomerID\">".$str."</A>";

$value = $link;

}

M
mnhuda author 7/17/2008

Dear Jane,

It works fine. I din't know/notice that there is custom view option.
Thanks a lot!!!