php search pass to html

Asked

Viewed 27 times

-1

Good morning, everyone.

I really need the help of vcs. I have a problem for days on an html page where I take 3 data to search the database. So far so good. I connect in the database, and I have the search return correctly via search.php, but, the data that is in search.php can not pass to html. The execution for php and appear on a blank page, not returning to the html page.

* code snippet in index.html: *

<select name="selsegmento" class="custom-select">

<option selected>Segmento</option>

<option value=""></option>

<option value="2">Restaurante</option>

<option value="3">Serviços Manuais</option>

</select> 
outro select...

<button type="submit" id="Buscar">Pesquisar</button>
</form>

* snippet of the.php search code: *

Search data:

<?php
    if (count($resultado) > 0){
?>
<table>
    <tbody>
        <tr>
            <th> segmento  </th>
            <th> nome </th>
        </tr>

        <?php
            foreach ($resultado as $res) {
        ?>
        <tr>
            <td><?=$res['seg_nome'];?></td>
            <td><?=$res['nome_nome'];?></td>
        </tr>
        <?php }?>
    </tbody>
</table>
<?php } else {?>
    <h3> Dados não encontrados </h3>

Thanks for the help.

  • 1

    Can you post all your code? What would be this $result variable?

  • Good morning, Angelo. I didn’t post any more because the code was so big. $Result is the result of sql, which has the lines with the data I have to put on the screen. So far that’s correct, so I haven’t put in this bit of code either.

  • The braces on this island <?php } else {?> is being closed? access the page and click on ver fonte da pagina ve if you have any errors embedded at the end of the source code.

1 answer

0

The full code would help us understand better. One would try to replace the code below: (is the only published snippet that contains short tags, if not displaying this part, may be the solution)

        <td><?php echo $res['seg_nome'];?></td>
        <td><?php echo $res['nome_nome'];?></td>

Browser other questions tagged

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