error while loading information in select

Asked

Viewed 45 times

0

I have this code that would have to load a select and just below one would have a textarea, however, after I put the php code to fill the select, my textarea is gone and I can’t identify the reason.

<?php $query = mysql_query("SELECT id, descricao FROM produto"); ?>
<div class="form-group">
    <label for="produto" class="col-sm-2 control-label">Produto</label>
        <div class="col-sm-10">
            <select class="form-control" name="produto" id="produto">
                <option>Selecione...</option>
                <?php while($prod = mysql_fetch_array($query)) { ?>
                <option value="<?php echo $prod['id'] ?>"><?php echo $prod['descricao'] ?></option>
                <?php } ?>
            </select>
        </div>
</div>
<div class="form-group">
    <label for="pessoaObservacoes" class="col-sm-2 control-label">Observações</label>
        <div class="col-sm-10">
            <textarea class="form-control" name="pessoaObservacoes" id="pessoaObservacoes" placeholder="Observações" rows="3"></textarea>
        </div>
</div>

  • ó the textarea there?!

  • Isn’t the point and comma you forgot here? Note: I added <option value="<? php echo $Prod['id']; ? >"><? php echo $Prod['Description']; ? ></option>

  • No, I already put those stitches and comma, but continued with the same problem.

  • At what point does the code no longer load? Are all options filled with the correct values? Which version of PHP do you use?

  • Your textarea is gone because there is some error in your code, using the echo on each line to know where the problem might be.

  • The version of my PHP is 7.0.13. The option does not load the database information. The application loads only the option without the database information. The problem is that no error code appears.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.