PHP Get value from database into selectbox -


i have problem show database values select box.

here code

<select name="bugsolver"> <?php    if(count($yourbugs) > 0)    {     foreach( $emails $key=> $singleemail)     { ?>   <option value="<?=$singleemail['email']?>" selected='selected'> <?php echo $singleemail['email']?></option>";  <?php } } ?>  </select> 

your code should this:

<select name="bugsolver">   <?php    if(count($yourbugs) > 0):     foreach( $emails $key=> $singleemail ):   ?>       <option value="<?php echo $singleemail['email']; ?>">          <?php echo $singleemail['email']; ?>       </option>    <?php     endforeach;   endif;   ?> </select> 

when code easy read (at least you) it's easier find bugs. if above code still doesn't work, var_dump($yourbugs) , var_dump($emails) check if these values set. can have disabled short tags (<?=) or variables empty.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -