Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I would take the value of the combobox by using getelementbyID to PHP variable, And The Code Like This

<select name="PROPINSI" onchange="document.getElementById('KOTAA').value = this.value" >
    <option value="a">a</option>
    <option value="b">b</option>            
 </select>

<select name="KOTA" id="KOTAA">
     <?php
         $propinsi = ; //in this variable, I want take this value

         $sqll="SELECT kota FROM master_propinsi WHERE propinsi = '$propinsi'";
                   $hasill= mysql_query($sqll);


                    while($dataa = mysql_fetch_array($hasill))
                    {            
                      echo "<option value='$dataa[kota]'>$dataa[kota]</option>";             
                    }

    ?>
 </select> 

Can SomeOne Help Me?

I really appreciate your answer Thanks

How to get value From Combo Box with ID="KOTAA" to variable $propinsi

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
612 views
Welcome To Ask or Share your Answers For Others

1 Answer

You cannot pass variable values from the current page javascript to the current page PHP code... PHP code runs at the server side and it doesn't know anything about what is going on on the client side.

You need to pass variables to PHP code from html-form using another mechanism, such as submitting form on GET or POST methods.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...