Why do I get error : Undefined variable?

前端 未结 4 526
难免孤独
难免孤独 2021-01-29 10:25

I created an input script. I write name and script post name into database. But I have error - ErrorException [ Notice ]: Undefined variable: result .

There

4条回答
  •  难免孤独
    2021-01-29 11:17

    Add the method attribute to your form:

    Change:

    if(!empty($_POST['name'])){
    

    To:

    $result = '';
    if(!empty($_POST['name'])){
    

    And ensure that:

    $this->template->content = View::factory('about/about')->set('result', $result);
    

    will work when $result is empty.

提交回复
热议问题