php - Get value form same table -
i have dropdown menu 3 values.

and here table (table name sms)

what want do? example : if choose 2,49 , press submit, sonum value.
this form
<div class="col_12" style="margin-top:100px;">     <div class="col_6">                  <label for="asukoht">vali hind</label>                 <form class="vertical" method="get">                     <select name="hind">                     <option value="1">-- vali --</option>                     <?php                      // tegin dropdown menüü, kust saab valida komponendi, mille alla see pilt läheb                     $andmed = mysql_query("select * sms");                       // dropdown menüü                     while($rida = mysql_fetch_array($andmed)){                         echo '<option value="'.$rida['id'] . '">'.utf8_encode($rida['hind'] ). '</option>';                     }                     ?>                     <input type="submit" name="add" id="add">                 </form>   i tried this
if(mysql_query("describe `sms`")) {                          $sql = "select sonum `sms`";                     echo $sql; }   i think should pretty easy, i'm looking solution , didnt found it.
thank helping !
you need work on sql , loop.
based on code:
if(mysql_query("describe `sms`")) {                          $sql = "select sonum `sms`";                     echo $sql; }   first change query including $_get parameter. this:
$sql = "select sonum `sms`";   will become:
$sql = "select sonum `sms` id = ".$_get['hind'];   it better if check var exist , setted like:
if(isset($_get['hind']) && is_numeric(trim($_get['hind']){//code here}   but off-topic. let's change echo $sql; loop, need loop , fetch data.
while($result = mysql_fetch_array($sql)){   echo '<option value="'.$result ['id'] . '">'.utf8_encode($result ['hind'] ). '</option>'; }   i've changed know, know system ^_^
Comments
Post a Comment