HTML does not load with php include_once()

Asked

Viewed 48 times

0

I’m trying to run a php file inside html,I get the file myself but when I call by include_once() in html the page just doesn’t load.

HTML

<div class="input-field col s4 m3">
        <select name="estado" id="id_estados" class="browser-default" >
            <option value="" selected="selected">Escolha o estado:</option>
            <?php include_once("../CRUD/Chamadas/listarEstados.php"); ?>
        </select>
    </div>

PHP

 <?php  
    include_once("../DAO/dalLocalizacao.php");

    $dalLocalizacao = new dalLocalizacao();
    $estados = $dalLocalizacao->listarEstado();

    while($estado = mysqli_fetch_array($estados))
    {
        $item = $estado['Nome'];
        $uf = $estado['Uf'];
        $item = utf8_encode($item);
        echo '<option  value="'.$uf.'">'.$item.'</option>';
    }
?>  

PHP2

<?php
include_once("../Classes/classLocalizacao.php");
include_once("../Classes/classConexao.php");
public function listarEstado()
    {
     $query = "SELECT * FROM Estado";
     $estados = $this->conexao->query($query) or die(mysql_error());
     return $estados;
    }
?>

Folder structure

inserir a descrição da imagem aqui

  • Go to the page and paste the last lines of the PHP error log to us. Great chance of being a path error (or even syntax error). Almost always the PHP log has the solution for this type of problem.

  • sorry the question the result of the browser console you speak ?

  • Error logging. is one of the first things that anyone who uses PHP should know, is where all the errors are recorded. Usually, when it is used with apache, it is in the same file. It depends on who set up the server.

  • Just to be sure, you’re accessing the files through a PHP server, right?

  • By the structure shown in the figure, the path in the PHP seems to be correct; form in folder form with ../DAO comes out of the folder form and enter the folder DAO. In PHP2 there are no elements to verify.

No answers

Browser other questions tagged

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