ferenan ferenan - 1 year ago 51
PHP Question

Forms showing up as plain text in Laravel 5

I'm pretty new to the Laravel universe.

So I was following a tutorial on OpenClassrooms and the tutorial is about Laravel 4 and I'm using Laravel 5, so I went through some trouble trying to adapt my controllers and getting them to work on my project, and after getting rid of many errors concerning the namespace dependencies, I'm getting a form which looks like text html that is not processed, here's what's showing up:

<form method="POST" action="http://gappsl/users" accept-charset="UTF-8">
<label for="nom">Enter your name:</label>
<input name="nom" type="text" id="nom">
<input type="submit" value="Submit">

Here's my controller:

<?php namespace App\Http\Controllers; use \View;
class UsersController extends Controller {
public function getInfos() {
return View::make('infos');

public function postInfos() {
echo 'The name is ' . Input::get('nom');

Here's my views:

@section('content') {{ Form::open(array('url'=>'users')) }} {{ Form::label('nom', 'Enter your name:') }} {{ Form::text('nom') }} {{ Form::submit('Submit') }} {{ Form::close() }}

<!doctype html>
<html lang="fr">
<meta charset="UTF-8">
<p> @yield('content') </p>

I hope you can help me.

Answer Source

In Laravel 5, {{ }} (for example {{ Form::open() }} escapes the variables in blade templates.

In Laravel 5, use {!! Form::open() !!} instead. Also, double check that it actually is a blade template you're using (and not a straight up PHP one).