Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have this code :-

<form action="<?php echo base_url();?>login/process" method="post" name="process">
    <h2>User Login</h2>
    <br />
    <?php if(! is_null($msg)) echo $msg;?>            
    <label for="username">Username</label>
    <input type="text" name='username' id='username' size="25" /><br />
    <label for="password">Password</label>
    <input type="password" name="password" id='password' size="25" /><br />                         
    <input type="Submit" value="Login" />         
</form>

But it not works.

when i remove this link

 <form action="<?php echo base_url();?>login/process" method="post" name="process">

after that it works.

Now my Question is how to use form URL inside CodeIgniter.

I know we can also do somehting like that :

<?=form_open('main/index/')?>

but I do not want to change my code right now.

share|improve this question
 
you can not use <form action=""> tag in codigniter.you have to use <?php echo form_open('admin/login/process');?> otherwise the form will not be submitted. –  Harshal Mahajan Aug 31 '12 at 7:04
 
:) ,have u solved issue? –  Harshal Mahajan Aug 31 '12 at 7:13
 
yes actually last time i forget to include <?php $this->load->helper('form'); ?> yes it works. –  user1635089 Aug 31 '12 at 7:16
 
can u please tell me which form tag you used? –  Harshal Mahajan Aug 31 '12 at 7:17
 
this one <?php echo form_open('login/process');?> –  user1635089 Aug 31 '12 at 7:19
show 5 more comments

1 Answer

up vote 0 down vote accepted

you can not use in codeigniter.Instead of that Use this:

<?php  echo form_open('admin/login/chk_admin');?>
    <h2>User Login</h2>
    <br />
    <?php if(! is_null($msg)) echo $msg;?>            
    <label for="username">Username</label>
    <input type="text" name='username' id='username' size="25" /><br />
    <label for="password">Password</label>
    <input type="password" name="password" id='password' size="25" /><br />                         
    <input type="Submit" value="Login" />         
</form>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.