Solved

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

Posted on 2003-12-07
3
193 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
3 Comments
 
LVL 6

Accepted Solution

by:
aolXFT earned 125 total points
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now