473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 1806
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="multiple">
<?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="selected"><?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="dresstypeform" method="post" action="<?php print
$_SERVER['PHP_SELF']?>">
<?php
$dresstypeid = $_REQUEST['dresstypeid'];
if ($dresstypeid >0) {
$drtresult = specificdresstype($dresstypeid); // query for the
specific dressing type
$dresscat = specdresscat($dresstypeid); //query for the wound stages
for a dressing type
$drtyperow = pg_fetch_array($drtresult);
?>
<input type=hidden name="dresstypeid" value= "<?php echo
$drtyperow["dresstypeid"]?>">
<?php
}
?>
<input type=hidden name="dresstypeid" value= "<?php echo
$drtyperow["dresstypeid"]?>">
<fieldset>
<legend>Dressing Type Information</legend>
<table align="left">
<tr>
<td><label for "dresstype">Dressing type</label></td>
</tr>
<tr>
<td><input type=text size="50" name=dresstype value = "<?php echo
$drtyperow["dressingtype"]?>" ></td>
</tr>
<tr>
<td><label for "stages">Stages</label></td>
</tr>
<tr>
<td>
<select name="stages[]" multiple="multiple">
<?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="selected"><?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="upddresstype" 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
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
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...
6
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
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-...
1
by: honeybee | last post by:
How to get the index of a selected intem in the listbox?
0
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...
1
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...
2
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...
1
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.