CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Many fileds in a list box where to put code

Print topic Send  topic

Author Message
David Brennan
Posted: 03/23/2003, 1:11 AM

Hi,

Hope someone can help me with this. I have many forms where it is desirable
to have multiple fields in a single list box. I have given an example below
after the message. My problem is that I cannot see a way of adding it in
codecharge so I have to edit the php files directly. Whilst this is not a
problem in itself good old cut and paste. The sheer no means it is easy to
forget so the code would be better in an event location.

Of course a this is my first attempt at php I may not have thought of the
most suitable solution to my original problem of identifying the entries in
the list box so any advice on that would be welcome.

The code below adds a Cloth Name supplier name and a colour to a list box
which is used to add a cloth to a form for a garment. The reason for the
supplier and colour is that the same cloth can come from multiple suppliers
and in multiple colours. So when we want to add a cloth we have used before
we need the extra info to identify it. The suppliers ref for the cloth would
be unique but as that could be anything from 5 to 9 digits it is no way for
a user to idebtify the cloth. Remember its my first go at php so if you
want to savage the code if u can improve it, I'm sure there must be a better
way than multiple lookups, but not me.
(the commented lines are the ones I added to the standard listbox code)
TIA

David

CODE

$lookup_fldClothID = db_fill_array("select fldClothID, fldCloth,fldClothType
from tblcloth order by 3");// Add Cloth Type so we can sort by it

if(is_array($lookup_fldClothID))
{
reset($lookup_fldClothID);
while(list($key, $value) = each($lookup_fldClothID))
{
$tpl->set_var("ID", $key);
$ClothType = Dlookup("tblCloth", "fldClothType", "fldClothID=$key");
//lookup type
$ClothSupplierID = Dlookup("tblCloth", "fldSupplierID",
"fldClothID=$key");//lookp Supplier ID
$ClothSupplier = Dlookup("tblSupplier", "fldSortName",
"fldSupplierID=$ClothSupplierID");// lookup SortName is it is short
$ClothColour = Dlookup("tblCloth", "fldClothColour",
"fldClothID=$key");// lookup colour
$value =
$value.'  (Supplier='.$ClothSupplier.' Colour='.$ClothColour.
' Type='$ClothType.')' ; // add it all together
$tpl->set_var("Value", $value);

if($key == $fldfldClothID)
$tpl->set_var("Selected", "SELECTED" );
else
$tpl->set_var("Selected", "");
$tpl->parse("ClothLBfldClothID", true);
}
}


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.