473,795 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you do selected in a multi-value list box in a form?

I am populating a list box from a dictionary table and then picking
muliple values to insert into a detail table. How do I get the list box
to have multiple selections highlighted when I pick one of the master
items?

May 25 '06 #1
2 1826
Here is part of the code with explaination

This is the cell in a table that is part of a form.

<td>
<select name="stages[]" multiple="multi ple">
<?php
$allstages = allstages();
while ($allstagerows= pg_fetch_array( $allstages)) {
$eachstage= $allstagerows["stageid"];
while($drcatrow = pg_fetch_array( $dresscat)){
if ($drcatrow["stageid"] == $eachstage){ ?>
<option value=<?php echo $eachstage;?> selected="selec ted"><?php
echo $allstagerows["stage"]?></option>
<?php }else{ ?>
<option value=<?php echo $eachstage;?>>< ?php echo
$allstagerows["stage"]?></option>
<?php }
}
}
?>
</select>
</td>

May 25 '06 #2
Here is the form I designed.
This form is to take a dressing type and choose all the wound stages it
can be used on.
there are 3 tables

dressing type table
dresstypeid
dressingtype

stages table
stageid
stage

dressingcat table
dresstypeid
stageid

<form name="dresstype form" method="post" action="<?php print
$_SERVER['PHP_SELF']?>">
<?php
$dresstypeid = $_REQUEST['dresstypeid'];
if ($dresstypeid >0) {
$drtresult = specificdressty pe($dresstypeid ); // query for the
specific dressing type
$dresscat = specdresscat($d resstypeid); //query for the wound stages
for a dressing type
$drtyperow = pg_fetch_array( $drtresult);
?>
<input type=hidden name="dresstype id" value= "<?php echo
$drtyperow["dresstypei d"]?>">
<?php
}
?>
<input type=hidden name="dresstype id" value= "<?php echo
$drtyperow["dresstypei d"]?>">
<fieldset>
<legend>Dressin g Type Information</legend>
<table align="left">
<tr>
<td><label for "dresstype">Dre ssing type</label></td>
</tr>
<tr>
<td><input type=text size="50" name=dresstype value = "<?php echo
$drtyperow["dressingty pe"]?>" ></td>
</tr>
<tr>
<td><label for "stages">Stages </label></td>
</tr>
<tr>
<td>
<select name="stages[]" multiple="multi ple">
<?php
$allstages = allstages(); //query to populate the listbox with all the
stages in the stage table
while ($allstagerows= pg_fetch_array( $allstages)) {
$eachstage= $allstagerows["stageid"];
while($drcatrow = pg_fetch_array( $dresscat)){
if ($drcatrow["stageid"] == $eachstage){ ?>
<option value=<?php echo $eachstage;?> selected="selec ted"><?php echo
$allstagerows["stage"]?></option>
<?php }else{ ?>
<option value=<?php echo $eachstage;?>>< ?php echo
$allstagerows["stage"]?></option>
<?php }
}
}
?>
</select>
</td>
</tr>
</table>
</fieldset>
<table align="left">
<tr>
<td><input type="submit" name="upddresst ype" value="Add-Update Dressing
Type" ></td>
</tr>
</table>

</form>

May 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
3882
by: * ProteanThread * | last post by:
but depends upon the clique: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=954drf%24oca%241%40agate.berkeley.edu&rnum=2&prev=/groups%3Fq%3D%2522cross%2Bposting%2Bversus%2Bmulti%2Bposting%2522%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den ...
0
3791
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black and white CCITT4 compressed files (frames) inside the tiff. Every now and then I receive a mixture of black and white CCITT4 and JPEG compressed files, and sometimes just multi-page tiffs with JPEG only. The code runs great when dealing with the...
6
8185
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
3
7440
by: Patrick De Ridder | last post by:
My textBox comes on with all the text selected. Setting "hide selection" to "true" or using SelectedText or SelectedTextLength will not stop the highlighting. How do I get rid of the text pre- selection when the display comes on? -- Many thanks, Patrick.
1
1353
by: honeybee | last post by:
How to get the index of a selected intem in the listbox?
0
926
by: Soul | last post by:
Hi, In ASP.Net page, Is there a way to retrieve those selected text from a normal TextField? For example, I have a multi-line TextField for user to enter some text. There is also a Button if user click on it after selected a text from the TextField, it will add something in front and after the selected text. Thank you.
1
2695
by: Marc R. | last post by:
hi, Is that such thing as selected collection exist ? I need a way to select all selected rows into a datagrid then "unchecked" the Active columns then save the result. but as soon i modified 1 row all other row aren't selected any more Do I have to build the rows collection my-self? thanks,
2
2696
by: Bill Nguyen | last post by:
Is there a way to send output from a .NET app to a selected monitor screen in a 3-monitor client desktop? Currently, my app sends output to 3 windows then I have to move/drag each of them to the proper monitor connected to the desktop. Thanks Bill
1
12848
by: Garudzo | last post by:
Hi all I am developning a small application in MS Access 2003 on a windows XP platform. I am using windows treeview and Listview controls. I have discovered that I can do a multi select of listview items but I cannot iterate through all selected items. the listview only has a selectedItem property and not selectedItems. How do i iterate through the selected listview items? Garudzo
1
1830
by: momenee | last post by:
Problem: How to set the Selected property of items in a CheckBoxList in the EditItemTemplate of a FormView control that has been populated initially using an ObjectDataSource. I have a column in a SQL Server 2005 table for a person's race. A CheckBoxList is used to get this information from the user. Since a person can be multi-racial, they can check multiple checkboxes. The checked values are saved as a comma-delimited string to the...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10216
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.