?
Solved

passing the values from one select/list box to other select/list box at the submit

Posted on 2003-12-07
3
Medium Priority
?
203 Views
Last Modified: 2006-11-17
I want to select the multiple values from the select box and would like to insert these values into another select box which is in the same page  and viceversa  at the click of submit , can anybody help me out in this.
0
Comment
Question by:prashkul2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
aolXFT earned 500 total points
ID: 9891906
Do you want to do this client-side or serverside? I'll assume it is serverside since this is the PHP area, and PHP is a serverside language.

to get multible values from a select field, you simply add the word multiple into the tag.

Then when you are processing the form serverside next time around you check if the value exists in the array and if so check it.

Eg:

<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sel_name[]" multiple>
<option value="val_one" <?php if(in_array('val_one', $_POST['sel_name'])){ echo "checked"; } ?>>Value 1</option>
...
...
</select>
<input type="submit" value="Submit">
</form>


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question