Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Howto Display lookup, Open URL with database value?

phpMyEdit General     Howto Display lookup, Open URL with database value?
Post new topic   Reply to topic    
 
rumex     Joined: 27 Oct 2017   Posts: 7  
Post Posted: 2017-10-27 13:40
Back to top  Reply with quote     

Hi Doug

I want to click a record and open a different form. The different form will filter by a value from the row.

I am not able to add to the URL a value from the table when I have performed a lookup from a different table. I want the foreign key 'AgencyId' and not the 'name' of the agency. Can you help?

---
I have two mysql tables:
agent has ID, name, AgencyID fields
agency has ID, name

I want to open a form showing all agents. Click an agent and have the agency form open, filtered by AgencyId.



/****
*** NAVIGATION from agent form to agency form ***
*** I want this to open the form and for the ***
*** form to only display this agency. ***
*** The database table key is AgencyId ***
****/
$opts['fdd']['AgencyId'] = array(
'name' => 'Agency',
// *** The lookup and the display are different here.
'values' => array('table' => 'agency', 'column' => 'id', 'description' => 'name'),
'URL' => 'http://localhost:81/html/agenter/agency.php?agencyId=$value',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2017-10-27 18:46
Back to top  Reply with quote     

I don't know, not functioning well today, see some examples.
https://www.phpvs.com/xmfg/txt/lookups.txt

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2017-10-29 01:58
Back to top  Reply with quote     

Skip the URL option and use CONCAT to create the link. Search the forum for CONCAT examples, the example below is what I had nearby and perhaps it will give you an idea.

$opts['fdd']['dummy2'] = array (
'name' => 'Thumbnail',
'sql|VLF' => 'if(category = "other",
CONCAT("<a href=\"", dir, "/", filename, "\" target=\"_blank\">link</a>"),
if(category = "thumb", CONCAT("<a rel=\"example_group\" href=\"", REPLACE(dir, "/tn", "/"), filename, "\" target=\"_blank\"><img src=\"", dir, "/", filename, "\" ", " alt=\"\" border=\"0\"></a><br><a href=\"fancybox.change.php?upld_id=", upld_id, "\">Replace</a>"), ""))',
'options' => 'VLF',
'input' => 'R',
'escape' => false,
'sort' => false
);


$opts['fdd']['logon_url'] = array(
'default' => '',
'input' => '',
'maxlen' => 255,
'name' => 'Logon URL',
'options' => 'XACPVD',
'required' => false,
'select' => 'T',
'size|ACP' => 60,
'sqlw' => 'TRIM("$val_as")',
'tab|ACPV' => 'LOGON URL',
'sort' => true,
'escape' => false,
'sql|LFV' => 'if(logon_url > "", CONCAT("<a href=\"", logon_url, "\" target=\"_blank\"", " title=\"", logon_url ,"\"", ">Go There</a>"), "")'
);

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2017-10-29 02:06
Back to top  Reply with quote     

'sql|LFV' => 'if(AgencyId > "0", CONCAT("<a href=\"otherPage.php?agencyID=", AgencyId, "\" target=\"_blank\"", " title=\"", AgencyId ,"\"", ">AgencyId</a>"), "")'

 
rumex     Joined: 27 Oct 2017   Posts: 7  
Post Posted: 2017-11-07 15:49
Back to top  Reply with quote     

Thanks, I put those together and got the following working

$opts['fdd']['NavParent'] = array (
'name' => 'GO',
//_self - open over current page
'sql|LFV' => 'if(AgencyId > "0", CONCAT("<a href=\"agency.php?agencyId=", AgencyId, "\" target=\"_self\"", " title=\"", AgencyId ,"\"", ">GO</a>"), "")',
'options' => 'L', // only visible on list
'input' => 'R', // no sql write
'escape' => false,
'sort' => false
);

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy