[eluser]Unknown[/eluser]
Hi,
I am using two views register.php and sidebar.php. sidebar.php is loaded inside the footer.php view
In register.php i have used the form helper function [see code],
Code:
<?php $this->load->view('header'); ?>
<?php $this->load->helper('form'); ?>
<h1 class="title"><?php echo $title; ?> </h1>
<?php echo validation_errors(); ?>
<?php echo form_open('register/add'); ?>
<table>
<tr>
<td><?php echo form_label('First Name'); ?></td>
<td><?php echo form_input('fname'); ?></td>
</tr>
<tr>
<td><?php echo form_label('Last Name'); ?></td>
<td><?php echo form_input('lname'); ?></td>
</tr>
<tr>
<td><?php echo form_label('Gender'); ?></td>
<td><?php echo form_radio('gender','0'); ?>Male <?php echo form_radio('gender','1'); ?>Female</td>
</tr>
<tr>
<td><?php echo form_label('Email'); ?></td>
<td><?php echo form_input('email'); ?></td>
</tr>
<tr>
<td><?php echo form_label('Phone'); ?></td>
<td><?php echo form_input('phone'); ?></td>
</tr>
<tr>
<td><?php echo form_label('Address'); ?></td>
<td><?php $data = array(
'name' => 'address',
'id' => 'address',
'rows' => '5',
'cols' => '30',
);
echo form_textarea($data); ?></td>
</tr>
<tr>
<td><?php echo form_label('Username'); ?></td>
<td><?php echo form_input('username'); ?></td>
</tr>
<tr>
<td><?php echo form_label('Password'); ?></td>
<td><?php echo form_password('password'); ?></td>
</tr>
<tr>
<td><?php echo form_label('Confirm Password'); ?></td>
<td><?php echo form_password('passconf'); ?></td>
</tr>
<tr>
<td></td>
<td><?php echo form_submit('submit', 'Register'); ?><?php echo form_reset('reset','Reset'); ?></td>
</tr>
</table>
<?php $this->load->view('footer'); ?>
Now in sidebar.php , i have this code -
Code:
<div id="sidebar">
<div class="login">
<h3>Login</h3>
<?php $this->load->helper('form'); ?>
<?php echo form_open('login/login'); ?>
<table>
<tr>
<td><?php echo form_label('Username'); ?></td>
<td><?php echo form_input('username'); ?></td>
</tr>
<tr>
<td><?php echo form_label('Password'); ?></td>
<td><?php echo form_input('pass'); ?></td>
</tr>
<tr>
<td></td>
<td><?php echo form_submit('submit', 'Login'); ?></td>
</tr>
</table>
</div>
</div>
Footer.php containes this code -
Code:
</div><!-- #content -->
<?php $this->load->view('sidebar'); ?>
</div><!-- #body -->
<div id="footer">
<p id="copyright">Here goes the copyright</p>
</div>
</div><!-- #wrap -->
</div><!-- #container -->
</body>
</html>
Now the problem is when i am on the register.php page, the "echo form_open('login/login')" function in the sidebar.php is not working. When i inspect the form, i dont see html <form> element in the sidebar code. But strangely on other pages (like homepage, contact page) , i can see the <form> tag when i inspect.
And when in register page, i click on the Login button of the sidebar, it gets submits to the register url
What is the problem here...? Feel free to ask for more info, i can give you this. I am stuck with this for 2 days.
Thanks in advance.