I am not receiving data via $ _POST

-1

I'm doing a 'project' with the MVC architecture and I'm having a problem, I already send data via post and get, but I do not know what's happening that I can not receive in a specific form, it might be silly, but already It took me hours and I decided to call here. The error that appears is a Notice: saying that I am not setting the 'name' index

Here's the function inside the controller (it's kind of messy with so much trial and error)

#Criar equipe
public function criarEquipe(){
    $this->validaAuth();

    $equipe = Container::getModel('Equipe');

    $equipe->__set('nome', $_POST['nome']);


    $id_usuario_lider = $_SESSION['id'];

    if ($equipe->__get('nome') != '') {
        # code...

        $equipe->salvarEquipe($id_usuario_lider);
        $this->render('cadastro');

    }
    $this->view->erroCadastroEquipe = false;

    $this->render('criaEquipe');
}

Here's my form

<form action="/criarEquipe" name="nome"  method="post">
      <div class="form-group">
        <input type="text" name="nome" class="form-control" placeholder="Nome da equipe">
      </div>

      <div class="mt-4 mb-4">
        <small class="form-text">
          Cadastrar equipe
        </small>
      </div>
      <button type="submit" class="btn btn-primary btn-block">Cadastrar</button>
      <?php if($this->view->erroCadastroEquipe){ ?>

        <small class="form-text text-danger">Erro ao tentar realizar o cadastro, verifique se os campos foram preenchidos corretamente!</small>

      <?php }?>

    </form>

and here is the save function in the Team class

    public function salvarEquipe($id){

    $query = "insert into equipe(nome, id_usuario_lider)values(:nome, :id_usuario_lider)";
    $stmt = $this->db->prepare($query);
    $stmt->bindValue(':nome', $this->__get('nome'));
    $stmt->bindValue(':id_usuario_lider',$id);
    $stmt->execute();

    return $this;
}

Thanks in advance to anyone who can help me.

    
asked by anonymous 03.01.2019 / 00:27

0 answers