0
I’m in a quandary at Laravel I can’t fix, and I’ve tried a lot of things, and now I’m stuck with this: echo of a column value of my table in a input in the html.
Code in the Controller:
public function retorna_curso()
{
$id_curso = Input::get('id_curso');
$cursos = DB::table('cursos')->get();
$select = DB::table('cursos')->where('id_curso', '=', $id_curso)->get();
return view('editar.update_curso')
->with('select', $select)
->with('cursos', $cursos);
}
Code in View:
<form action="/updt_curso" method="post">
<div class="form-group col-md-12">
<?php
if(isset($select))
{
echo' <div class="form-group col-md-12">
<label for="edt_nome">Editar nome do curso:</label>
<input type="text"
class="form-control"
name="input_nomeCurso"
value="'.$select['nome'].'"
id="nomeCurso">';
echo'
</div>
<div class="form-group col-md-4">
<input type="submit"
value="Atualizar"
class="form-control btn btn-primary">
</div>';
}
?>
</div>
</form>
He enters the if, but makes an exception by saying that the property nome does not exist in the array $select that send back to the page.
- What I could do to solve this problem?
- What’s left to work?
It worked perfectly. I can’t believe it was that simple after so much stuff I tried kkkk. Thank you Miguel!
– WitnessTruth
You’re welcome @Renan, thank goodness
– Miguel