Jump to content
Fórum Script Brasil
  • 0

(Resolvido) select html não imprime valores php


Ricardo T. do Prado

Question

Pessoal, to com uma dúvida, os dados do BD não estão sendo imprimidos nos select,

segue codigo

if($key == "select") {
            
            $var = explode(',',$value);
            
                        conexao();
            
            $sql = mysql_query("select ".$var[1].", ".$var[2]." from ".$var[0]."") or die (mysql_error());
            
            $row = mysql_fetch_row($sql);  //até aqui ok, já testei, a linha debaixo não colocar os valores dentro do atributo "Value"
            
            $input []  = "<select name=".$var[4]."> <option> ---selecione --- </option> <option value='".$row[1]."'> ".$row[2]."</option> </select> ".$var[4]." ";
        }
Como que ficaria? o que estou fazendo de errado ae? Era falta de atenção, segue solução
if($key == "select") {
            
            $var = explode(',',$value);
            conexao();
            
            $wizard = "<select name=".$var[4]."> <option> ---selecione --- </option>";
            
            $sql = mysql_query("select ".$var[1].", ".$var[2]." from ".$var[0]."") or die (mysql_error());
                
            while($row = mysql_fetch_row($sql)) {
                $wizard.="<option value=".$row[0].">  ".$row[1]." </option>";
            }
            
            $wizard.=" </select>";
            
            $input[] = $wizard;
        
        }

Abs.

Abs.

Edited by Ricardo T. do Prado
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...