3
I’m a beginner in Laravel and I’m having a problem with routes and controllers. I created a form with the following action:
{{ Form::open(array('action' => 'MatriculasController@formulario' }}
I created a route for this action:
Route::post('formulario', 'MatriculasController@formulario');
The Matriculacontroller form method does some operations with the data received from the form and should return a View:
//função que recebe e manipula os dados do formulario
public function formulario(){
//recebe os dados do formulario
$ra=$_POST['ra'];
$aluno=$_POST['nome'];
$nasc=$_POST['nascimento'];
$responsavel=$_POST['responsavel'];
$cpf=$_POST['cpfResponsavel'];
//verifica se o RA foi fornecido
if (strlen($ra>0)){
$siga = new Siga();
$consultaRA=$siga->conecta("select NOM_PESSOA from supervisor.PESSOA where COD_PESSOA='$ra'");
$resultado=mssql_fetch_array($consultaRA);
$nome=utf8_encode($resultado['NOM_PESSOA']);
return View::make('confirmaIdentidade');
}
.
.
.
}
The View confirms identity:
@extends('templates.templateVeterano')
@section('conteudo')
teste
@stop()
The problem is that it is not returning this view and I do not understand the reason. It is returning a blank page with the url /form.
Does anyone know what I might be doing wrong?
Amanda Lima, has happened to me a lot. In order to help you, you will have to post part of your controller. At least the methods involved
– Wallace Maxters
There could be many things: You’re using a Section that doesn’t exist in the parent view. You’re accessing a method that doesn’t return anything.
– Wallace Maxters
I’ll edit and post all the code
– Amanda Lima
+1 Because I love Laravel!
– Wallace Maxters
If I had known better, I’d have hit you like a cousin, huh!
– Wallace Maxters