View Full Version : Combo box with "Multiple" select option

07-11-2003, 12:58 AM
Ok. This what I have so far:
when I select an option in the drop-down menu,
the description is displayed in the textarea.
The code below works fine but if I add the
option "multiple" to my select statement then
I need to change my select name to "one[]" so
PHP will recognize it as an array.
When I do this and change the name to "one[]" in
my javascript, nothing will display in the

Does anyone have an idea about how I might
accomplish this?

I just started programming Javascript
about 3 weeks ago so any help would be
greatly appreciated

Thank you


<form name='forma'>

<fieldset><legend $lft>$font4w<strong>Asset Management$ef</legend>
<table background='5.jpg' width='100%'>
<td $lft><select name='one' size='1' onChange='show_one()'>";
echo "
<td $rgt>
<textarea rows=2 cols=60 wrap='virtual' name='text_one'></textarea>

<script language="javascript">
var am=document.forma
var am_desc=new Array()

am_desc[0]="<?php echo $am_desc[0] ?>"
am_desc[1]="<?php echo $am_desc[1] ?>"
am_desc[2]="<?php echo $am_desc[2] ?>"
am_desc[3]="<?php echo $am_desc[3] ?>"
am_desc[4]="<?php echo $am_desc[4] ?>"


function show_one()

This is where I load my options from a database:
The info in the select box is variable $rn
and the description is variable $ad which I load
into an array.

function get_it($role)

global $am_desc;

$qry="select * from ps_access where access_code='$role'";
echo mysql_error();
while(list($rn, $ad)=mysql_fetch_row($result))

echo "<option value='$rn'>$rn</option>";

07-11-2003, 01:12 AM
Bracket characters are swell in php but murder on (JS) dot syntax. Try:


07-11-2003, 06:04 AM
That worked perfectly. I really appreciate the help. You guys are great

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum