I had posed this question once before and now it has come to bite me again.
I have a drop down wizard field based on a table. In the wizard I have flagged it to Use table for values but show Name on display, and store the record number in the database field.
Do so all works fine, except when I go to print the selected items. Having the link field and the display field different, breaks the printout of the selected items.
I was told I could correct the problem by making the database field larger and store the selected Names in the field instead of the linked field value.
That does work.
BUT, the issue I have is
- The waste of space in storing the Name(s) in the field. I can get 10 selects in a field using the record number link field rather than storing the NAME data (which could be 100 characters each).
- If I do adopt the above method, and for whatever reason I change the Name, opening an older record with the old name of course will not resolve to the picklist build by phprunner.
I really need a fix for this.
I need to store the link field values in the field, yet print ALL the selected Names relating to the link values stored in the database field.
It does print the first selected field correctly, and then stops so I only get the first Name of the multi select choices saved. Opening the record for editing, works perfectly.
Is there something I can fix to get ALL the printed selected Names when printing.
Please.
Any suggestions would be greatly appreciated.
Below is the actual snippet produced by phprunner for the Multi select field in question.
echo "<tr><td> </td><td> </td><td>";
$iquery="field=".array_search("components",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);
if($strKeyField2)
$iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);
if($strKeyField3)
$iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);
?>
<?php
if(IsBinaryField($rsData,"components"))
{
$value=db_stripslashesbinary($data["components"]);
$fileinfo="";
$itype=SupposeImageType($value);
if($itype)
$disp='<img border=0 src="purchases_imager.php?'.$iquery.'">';
else
{
if(strlen($value))
{
$disp='<img border=0 src="images/file.gif">';
$fileinfo=' ('.strlen($value).' bytes)';
}
else
$disp='<img border=0 src="images/no_image.gif">';
}
if(!"" || !($filename=$data[""]))
$filename="file.bin";
else if($fileinfo)
$fileinfo=" ".$filename.$fileinfo;
if(Format("components")==FORMAT_DATABASE_FILE)
echo '<a href="purchases_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;
else
echo $disp;
}
else
{
if(strlen($data["components"]))
{
$strdata = make_db_value("components",$data["components"]);
$LookupSQL="SELECT concat(name) FROM `components` WHERE `component_id` = " . $strdata. " and (". " 1=1 ".")";
LogInfo($LookupSQL);
$rsLookup = db_query($LookupSQL,$conn);
if($lookuprow=db_fetch_numarray($rsLookup))
echo ProcessLargeText($lookuprow[0],"","",MODE_PRINT);
else
echo ProcessLargeText(GetData($rsData,$data,"components", ""),$iquery,"",MODE_PRINT);
}
}
echo "</td><td> </td></tr>";
?>
Thankyou in advance for any suggestions to get this working. My client is pressuring, what else is new!