edw Posted April 2, 2008 Report Share Posted April 2, 2008 Sveiki, pienemsim, ka man ieks sql ir sada tabula +----+--------------+ | id | nosaukums | +----+--------------+ | 1 | viens | | 2 | divi | | 3 | triis | | 4 | chetri | | 5 | pieci | +----+--------------+ ar drop down box palidzibu atlasu "nosaukums" vertibas. Bet tagad vajag panakt, lai izveloties drop down boxa, piemeram, "divi " tiktu definets mainigais "x", kas saja gadijuma butu 2, un ja izvelos " triis" - x=3 utt. Seit bus tas, ko esmu jau uztaisijis $query = "SELECT id, nosaukums FROM $tabula ORDER BY id ASC"; $result = mysql_query($query); <select size="1" name="nosaukums" > <?php while ($row = mysql_fetch_object($result)) { ?> <option><?php echo $row->nosaukums;?></option> <? }?> </select> Link to comment Share on other sites More sharing options...
Aleksejs Posted April 2, 2008 Report Share Posted April 2, 2008 Man šķiet, ka galā gribi kaut ko šitādu dabūt ;) ... <option value="<?php echo $row->id;?>"><?php echo $row->nosaukums;?></option> ... Link to comment Share on other sites More sharing options...
edw Posted April 2, 2008 Author Report Share Posted April 2, 2008 nee, man vaja lai izveloties "triiis" x tiktu piesaistita "triiis" id vertiba Link to comment Share on other sites More sharing options...
Aleksejs Posted April 2, 2008 Report Share Posted April 2, 2008 <select size="1" name="nosaukums" onchange="x = this.options[this.selectedIndex].value;"> ... <option value="<?php echo $row->id;?>"><?php echo $row->nosaukums;?></option> Link to comment Share on other sites More sharing options...
edw Posted April 2, 2008 Author Report Share Posted April 2, 2008 paldies ;) Link to comment Share on other sites More sharing options...
Recommended Posts