<?php session_start();

require "script_php/conexao.php";

$usuario = filter_var( $_POST['user'], FILTER_SANITIZE_STRING);
$senha = filter_var( $_POST['ps'], FILTER_SANITIZE_STRING);

?>

<!DOCTYPE html>
<html>
<head>

<?php include_once 'head.html' ?>

<title></title>
</head>

<body>
<section class="login">
<?php //include_once 'header.php'; ?>

<img src="IMG/empresa.png" height="70px">
<p></p>

  <form action="script_php/valida.php" method="post">

  <input type="hidden" name="usuario" value= <?=$usuario; ?> >
  <input type="hidden" name="senha" value= <?= $senha ; ?> >

    <div class="form-group">
    <label for="exampleInputEmail1">Escolha uma empresa</label>
    

      <select name="loja" class="form-control" id="">

<?php

$result = "SELECT * FROM usuarios WHERE usuario = '$usuario' ";

$resultado = mysqli_query($conexao, $result);

while($linha = mysqli_fetch_array($resultado)){

echo $linha['matriz'];

?>


<?php if ($linha['matriz'] == "sim"){ ?>
<option value="matriz"> Matriz </option>
<?php } ?>

<?php if ($linha['loja02'] == "sim"){ ?>
<option value="loja02"> Loja 02 </option>
<?php } ?>

<?php if ($linha['loja03'] == "sim"){ ?>
<option value="loja03"> Loja 03 </option>
<?php } ?>

<?php if ($linha['loja04'] == "sim"){ ?>
<option value="loja04"> Loja 04 </option>
<?php } ?>

<?php if ($linha['loja05'] == "sim"){ ?>
<option value="loja05"> Loja 05 </option>
<?php } ?>

<?php } ?>

      </select>


  </div>


  <input type="submit" name="botao"  class="btn btn-info form-control" value="Entrar">
</form>

</section>
<?php include_once 'footer.php' ?>