Ejemplo n.º 1
0
        </div>
        <button type="submit" class="btn btn-primary">
            <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
            Pesquisar</button>
    </form>
    
</fieldset>

<?php 
include 'footer.php';
?>

<?php 
require 'dados.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $nome = trim(filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
    $professorid = filter_input(INPUT_POST, 'professorid', FILTER_SANITIZE_NUMBER_INT);
    $aluno = array();
    if (!empty($nome)) {
        $aluno['nome'] = ucwords($nome);
    }
    $result = getAlunoByNome($aluno);
    if ($result == FALSE) {
        header("location: novo.php?nome=" . ucwords($nome));
        die;
    }
    session_start();
    $_SESSION['aluno'] = $result;
    header('location: tabelarank.php');
    die;
}
Ejemplo n.º 2
0
<?php

require 'dados.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $nome = filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_MAGIC_QUOTES);
    $professorid = filter_input(INPUT_POST, 'professorid', FILTER_SANITIZE_NUMBER_INT);
    $aluno = ['nome' => ucwords($nome), 'professorid' => $professorid];
    addAluno($aluno);
    $result = getAlunoByNome(['nome' => ucwords($nome)]);
    session_start();
    $_SESSION['aluno'] = $result;
    header("location: addrank.php");
    die;
}
?>

<?php 
include 'header.php';
?>
    <h1>Novo Aluno</h1>
    <form method="post"  >
            <div class="form-group">
                <label>Nome</label>
                <input type="text" name="nome" required="" autofocus="" size="50" 
                       class="form-control" placeholder="Informe seu nome completo."
                       value="<?php 
echo isset($_GET['nome']) ? $_GET['nome'] : '';
?>
">    
            </div>
            <div class="form-group">