Hey all,
I've found a lot of good help here on Daniweb, but this is my first post :)

Here's my situation:

I have a form that has 2 select boxes with multiple options.

For the First dropdown, I have assigned IDs to each option (1,2,3,etc)
For the Second dropdown, I have also assigned IDs to each option (01,02,03,etc)

When they choose an option from both select boxes and hit submit, I need to the form to processes the information so it realizes that both a First_id and a Second_id are selected, combines the two together -- $First_id.$Second_id -- and redirect the user to another page.

Hope that makes sense and someone can help me out.
Thanks!

hi and welcome to daniweb, what you can do here is assign different names to the select boxes. you then have 2 different variables with different values.

then you can concantenate the first id to the second id and then redirect to the new page.

sounds good, thanks!
you wouldn't happen to have some example code too would you? ;)

If you need only two simple select box, then create function, for example:

function fetch( $table , $id , $field )
{
    $res = mysql_query( "select $id, $field from $table ORDER BY $field" );
    if ( mysql_num_rows( $res ) > 0 ) {
        while ( $rows = mysql_fetch_assoc( $res ) )
        $out[$rows[$id]] = $rows[$field];

        return $out;
    }
}

function listbox( $name , $label, $vals )
{
    echo $label;
    ?>
    <select name="<?php echo $name ?>[]" id="<?php echo $name ?>" multiple="multiple" >
    <option value="">========</option>
   <?php
    foreach( $vals AS $key => $value ) {
        if ( isset( $_POST["$name"] ) ) {
            if ( in_array($key, $_POST["$name"]) )
                $selected = ' selected="selected"';
            else
                $selected = "";
        } else
            $selected = '';

        ?>
    <option value="<?php echo $key ?>"<?php echo $selected;
        ?>><?php echo $value?></option>
    <?php

    }

    ?>
    </select>
    <?php
}
//$name , $label, $vals     ,       $table , $id , $field 
listbox("list1" , "List1" , fetch("table1","id1","field1")); 
listbox("list2" , "List2" , fetch("table2","id2","field1"));

on the landing page you reach the posted values in $_POST["list1"] and $_POST["list2"] arrays. Notice that this two functions are making multiple select boxes.

Can you exmplain this question a bit detailed?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.