[eluser]solid9[/eluser]
Hi guys I have this basic error,
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: username
Filename: views/header.php
Line Number: 37
I just want to pass the $username into hear.php view file.
<b>controller:</b>
Code:
//log the user in
function login()
{
$username = 'GOD';
$this->data['header'] = $this->load->view('header', $username, TRUE);
$this->data['midnav'] = $this->load->view('body_m_frontpage', null, TRUE);
$this->load->view('front_page', $this->data);
}
<b>view:</b>
Code:
<div class='wrapper-head'>
<div class='logo'>
<a href="http://barterswapping.com">
<img name="logoholder" src="<?php echo base_url('img/barterlogo.jpg'); ?>" width="200" height="130" alt="barterswapping.com">
</a>
</div>
<div class='login' align="right">
<table border="0" bgcolor="red"><tr><td>
<?php echo form_open("main/process_login");?>
<?php echo form_input('identity', 'Username');?>
<?php echo ' '; ?>
<?php echo form_input('password', 'Password');?>
<label for="remember">Remember Me:</label>
<?php echo form_checkbox('remember', '1', FALSE);?>
<?php echo ' '; ?>
<?php echo form_submit('submit', 'Login');?>
<?php echo form_close();?>
</td>
<td>
<?php echo anchor('main/create_user', 'Register', 'title="Register"'); ?>
</td>
<td> </td>
<td>
<?php echo anchor('main/forgotpass', 'Forgot Password?', 'title="ForgotPassword"'); ?>
</td>
<td>
<?php echo anchor('main/lgout', 'Logout', 'title="Logout"'); ?>
</td>
</tr>
</table>
<table border="0" bgcolor="black">
<tr>
<td align="right">
<b>
<?php echo $username; ?>
</b>
</td>
</tr>
</table>
</div>
<div class='menu'>
<div id="navcontainer">
<ul>
<li><a href="#">How it works?</a></li>
<li><a href="#">How to trade?</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Donate</a></li>
</ul>
</div>
</div>
</div>
Can you guys help me pass the $username properly into view.
Thanks in advanced.