I wanted to save the user name that is in the session and save it in the user_user field in the database but it is giving error the way I did

0

Login.php file

 <?php
 $conn=mysqli_connect ("localhost","root","","xerox");

 if(isset($_POST['email']) && isset($_POST['senha'])){

 $email = $_POST['email'];
 $senha = $_POST['senha'];

 $get = mysqli_query ($conn, "SELECT * FROM usuarios WHERE email = '$email' AND senha = '$senha'");
 $num = mysqli_num_rows($get);

 if($num == 1){
 while ($percorer = mysqli_fetch_array($get)){
 $adm = $percorer['funcao'];
 $nome = $percorer['nome'];

 session_start();
 $id_usuario = mysqli_query ($conn, "SELECT nome FROM usuarios");
 $_SESSION['nome'] = $id_usuario;
 $SESSION['logado'] = true;

if ($adm == 0) {
    $_SESSION['coor']= $nome;
    header ("Location: dentro.php");
}

if ($adm == 1) {
    $_SESSION['prof']= $nome;
    header ("Location: dentro.php");
}

if ($adm == 2) {
    $_SESSION['rep']= $nome;
    header ("Location: dentro.php");

} 
 } 
 } else {
    echo 'O email ou senha digitados estão INCORRETOS.';
}   
 }
 ?>

Reqenviada.php file

 <?php
 session_start();

 //include("check.php");
 $id_usuario = $_SESSION['nome'];
 $_SESSION['nome'] = $id_usuario;
 $_SESSION['logado'] = TRUE;

 ?>
 <?php


 $assunto=$_POST['assunto'];
 $tipo=$_POST['tipo'];
 $quant=$_POST['quant'];
 $dataentrega=$_POST['dataentrega'];
 $anexo=$_POST['anexo'];

$servidor='localhost';
$banco='xerox';
$usuario='root';
q$senha='';

 $conexao = mysqli_connect($servidor,$usuario,$senha);
 mysqli_select_db($conexao, $banco);
 $sql= mysqli_query($conexao,"INSERT INTO requisicao (id_usuario, tipo, quant, anexo, assunto, dataentrega, status, impresso) VALUES ('$id_usuario', '$tipo', '$quant', '$anexo', '$assunto', '$dataentrega', 'pendente', 'não')");

 echo ("Requisicao enviada com sucesso!")

 ?>

 <br/><br/>


 <table border="1">
<tr>
    <th>Número</th>
    <th>Requerente</th>
    <th>Data do Requerimento</th>
    <th>Tipo</th>
    <th>Quantidade</th>
    <th>Anexo</th>
    <th>Assunto</th>
    <th>Data de Entrega</th>
    <th>Status</th>

    </th>


    </tr>
   <tr>
    <td> 
    <?php
    echo $_POST["id"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["$id_usuario"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["data_req"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["tipo"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["quant"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["anexo"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["assunto"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["dataentrega"];
    ?>
    </td>
    <td> 
    <?php
    echo $_POST["status"];  
    ?>

    </td>
</tr>

 </body>
 </html>
    
asked by anonymous 18.06.2018 / 13:19

0 answers