user3423301
user3423301

Reputation: 43

Inside php script isn't working

Im new to php and its developing. i'm using codeigniter. header tag is the only tag display there .latter part of script isn't avaliable in view page. my login_view.php code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
        <title> Login page </title>
</head>


<body>

<div id="container">
    <h1>Login</h1>
        <?php

        echo form_open();

        echo "<p> Email :";
        echo form_input('email');
        echo "</p>";

        echo "<p> password :";
        echo form_input('password');
        echo "</p>";

        echo "<p>";
        echo form_submit('login_submit','login');
        echo "</p>";

        echo form_close();
    ?>    

   </div>       

</body>
</html>

and its page source

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
        <title> Login page </title>
</head>


<body>

<div id="container">
    <h1>Login</h1>

login.php -controller

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {


    public function index()
    {
        $this->load->view('login_view');
    }
}

Upvotes: 0

Views: 87

Answers (2)

itachi
itachi

Reputation: 6393

as far as my CI memory goes back, you have to do like this.

class Login extends CI_Controller {


    public function index()
    {
        $this->load->helper('form'); //<----------- this
        $this->load->view('login_view');
    }
}

Upvotes: 0

Jobayer
Jobayer

Reputation: 1231

You need to load form helper using $this->load->helper('form'); in controller or config file for showing it. At first, check it and if still you face any problem, then post your controller.

Upvotes: 2

Related Questions