views:

70

answers:

1
<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>";
+1  A: 

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")
Kolky
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?
i have tried $F() but i am not getting the value from option