Question

I'm using Laravel, and it complains about $header inside the Form::text being a illegal string offset, how do I fix this? It doesn't complain if I go straight into the page, but if I submit a form with get method going into the page. I searched around and maybe it thinks $header is an array?

<?php 
        $header = null;
        if(isset($_GET["header"])) {
            $header = $_GET["header"];
        }

        echo Form::text('header', $header, array('class'=>'form-control', 'placeholder'=>'Tittel'));
?>
Was it helpful?

Solution

Laravel clears the $_GET array. You need to use Input::has('header') and Input::get('header') instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top