Jump to content

list box, mutliple selection


romio

Recommended Posts

[code]
<td valign='top'>
    <select name="copy1" multiple size='10'>
         <?php
        echo $list_countries = "SELECT * FROM languages_main ORDER BY id";
        $query_list_countries = mysql_query($list_countries);
        $num_rows = mysql_num_rows($query_list_countries);
        while($row = mysql_fetch_array($query_list_countries))
            {
                $id = $row['id'];
                $country_name = $row['lang_name'];
                echo "<option value='$id'>$country_name</option>";
            }
    ?>    
        </select>
</td>
<td valign='middle' align='center'>
    <input type="button" name="right" value="&gt;&gt;" onClick="copySelectedOptions(document.forms[0]['copy1'],document.forms[0]['copy2'],false);return false;"><BR><BR>
    <input type="button" name="right" value="&lt;&lt;" onClick="removeSelectedOptions(document.forms[0]['copy2']); return false;"><BR><BR>
</td>
<td>
    <select name="copy2" multiple size=10></select><br />
</td>
<tr>
    <td><input type='submit' name='submit' value='Submit'></td>
</tr>
[/code]

copy1 has 20 countries listed in it(static), copy2 will the be the second list box which will be filled when a user select a country from copy1, my question is how can I get all the selected item from copy2 in order to insert it into my table?
Link to comment
Share on other sites

php is a server side script so copy2 will not populate unless you submit your selection to be parsed to the server. in another words you will have to have one list box with the countries in it with a submit button. Once they select the country they hit the submit button the page will reload and the second list box will populate with what you want.

Hope that helps

Ray
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.