Tko_1 0 Junior Poster

This is not my code/script all hardwork came from Codelair
Full script located here

I really hope i posted this in the correct section because im unsure which code will work best for this.

As the name for the script gives this away it is a scoreboard. allows admin to create questions and users to answer them with write in text field.
so i was just messing around with this and am trying to have dropdown value to text field. as i can get this to work with the first question by asigning an id to the input type

        $HTML .= '<div class="required">' . "\n";

        $HTML .= '  <label for="contest-q' . $scoreboard['questions'][$i]['number'] . '">' .
                    str_format( $scoreboard['questions'][$i]['name'] ) . '</label>' . "\n";
        $HTML .= '  <input type="text" id="result"  name="contest[' . $scoreboard['questions'][$i]['number'] . ']" value="DRAW""' .


            ( isset( $entry[$i] ) ? str_format( $entry[$i] ) : '' ) .
            '" id="contest-q' . $scoreboard['questions'][$i]['number'] . '" />' . "\n";
            $HTML .= '<select onchange="OnSelectionChanged (this)">
            <option value="option 1" selected="selected">option 1</option>
              <option value="option 2">option 2</option>
  <option value="option 3">option 3</option>
    </select>' . "\n";


        $HTML .= '</div>' . "\n";
    }


    $HTML .= '</fieldset>' . "\n";
    //$HTML .= '<span class="submit button">Submit!</span>' . "\n";
    $HTML .= '<button type="submit" value="Submit!">Submit!</button>' . "\n";
    $HTML .= '</form>' . "\n";

    return $HTML;
}



<head> 
    <script type="text/javascript">  
        function OnSelectionChanged (listBox){
            var textInput = document.getElementById ("result");
            textInput.value = listBox.value;
        }
    </script> 
</head> 

however when there is more than one question the dropdown for the other questions just change the value in the first text box which i am assummling because i need to associate the dropdown with the next question maybe ?
Any help or direction would be very appreciative.
Thank you

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.