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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -