Welcome Guest, Not a member yet? Register   Sign In
Loading in Verifylogin/auth the picture will not appear
#1

[eluser]nOsCiRe[/eluser]
My verifylogin in controllers


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

class Verifylogin extends CI_Controller {

function _construct()
{
parent:: _construct();
/*$this ->load->models('user','',TRUE);*/
}

function index()
{
$this->auth();
}

function auth()
{

$this->load->library('form_validation');
$this->form_validation->set_rules('username','username','trim|required|xss_clean');
$this->form_validation->set_rules('password','password','trim|required|xss_clean|callback_check_database');


if($this->form_validation->run()==FALSE)
{
//this where it runs when the username or password is invalid;
//when loading the view_login in localhost/codeigniter/verifylogin/auth my picture in it will not appear but in localhost/codeigniter the picture will appear please help me on this matter. tnx in advance

$this->load->model('homedetails');
$data['homepic'] = $this->homedetails->homepic();
$this->load->view('view_login',$data);
}
else
{
//
redirect('home','refresh');
}

}
function check_database($password)
{
$username = $this->input->post('username');
$this->load->Model('user');
$result = $this->user->login($username,$password);

if($result)
{
$sess_array = array();
foreach($result as $row)
{
/*$sess_array = array('id' => $row->id,
'username'=>$row->username
);*/
$sess_array = array('username'=>$row->username,'password'=>$row->password);
$this->session->set_userdata('logged_in',$sess_array);
}
return TRUE;
}
else
{
$this->form_validation->set_message('check_database','Invalid Username or Password!');
return false;
}
}
}
?>

in my views

<?Php foreach($homepic->result_array() as $data):


$image_filename = $data['image_filename'];

$image_altname = $data['image_altname'];

echo "<li>";

echo "<img src = 'images/$image_filename' width = '582' height = '365' />";

echo "</li>";

endforeach;
?&gt;

try also this one making static the picture in views

<li>

<img src = 'images/test.jpg' width = '582' height = '365' alt = 'test' />

</li>
#2

[eluser]InsiteFX[/eluser]
Code:
&lt;head&gt;
    &lt;base href="&lt;?php echo base_url();?&gt;" /&gt;
&lt;/head&gt;

CodeIgniter User Guide - HTML Helper See img()




Theme © iAndrew 2016 - Forum software by © MyBB