How to retrieve the value from Select html element using JS prototype in php?

10,622

I think what he means is only the small javascript part of getting the value from the select box in his reload function:

$("seltab").getValue();

seems the API says there's even a short for that: (http://api.prototypejs.org/dom/form/element/getvalue/)

$F("seltab")
Share:
10,622
Vicky
Author by

Vicky

Updated on June 09, 2022

Comments

  • Vicky
    Vicky almost 2 years
    <script type="text/javascript" src="prototype.js"></script>
        <script>
        function reload(form){
        var val = $("seltab");alert(val);
        }</script>
    echo "<form method = post name = f1 action = '' >";
        echo "<select id = seltab onchange =  'reload(this.form)'>";
            $querysel = "SELECT title_id,author FROM authors NATURAL JOIN books";
        $result1 = mysql_query($querysel) ;
        while($rowID = mysql_fetch_assoc($result1))
        {
            $TitleID = $rowID['title_id'];
            $author = $rowID['author'];
            print "<option value =$TitleID>$author\n";
            print "</option>";
        }
        print "</select>";
    
  • Vicky
    Vicky about 14 years
    i am using javascript(JS prototype) in php. i have bond the database value into dropdown and now i select one of option in the dropdown and database according to it should be shown?