Welcome Guest, Not a member yet? Register   Sign In
I have placed 2 forms in a same html page using form_open and form_close, Only one form is getting build
#1

[eluser]Anjith Kumar Garapati[/eluser]
Hi,

I have placed 2 forms in a same html page using form_open and form_close, Only one form is getting build and when ever i submit form both the forms are submitted to first mentioned action url in form_open. I have closed first form by using form_close(), before starting second form.

Here is the code in the view,
Code:
<table width="557" height="82" border="0" align="left" cellpadding="0" cellspacing="5">

&lt;?php
$username = array(
    'name' => 'txtEmail',
    'id' => 'txtEmail',
    'title' => 'Email',
    'value' => ''
);
$password = array(
    'name' => 'txtPassword',
    'id' => 'txtPassword',
    'title' => 'Password',
    'value' => ''
);
$submit = array(
    'name' => 'Login',
    'id' => 'Login',
    'title' => 'Login',
    'value' => 'Login'
);
?&gt;
&lt;?php echo form_open('user/login'); ?&gt;
    <tr>
        <td width="65" class="password">Email</td>
        <td width="18" class="password">:</td>
        <td width="120">&lt;?php echo form_input($username); ?&gt;</td>
        <td width="81" align="center" class="password">Password</td>
        <td width="16" class="password">:</td>
        <td width="108">&lt;?php echo form_password($password); ?&gt;</td>
        <td width="109" align="center">&lt;?php echo form_submit($submit); ?&gt;</td>
    </tr>
&lt;?php echo form_close(); ?&gt;
<tr><td width="100%">&lt;?php echo validation_errors();  ?&gt;</td></tr>
</table>
<table width="840" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8"></td>
</tr>
&lt;?php
$regEmail = array(
'name' => 'regEmail',
'id' => 'regEmail',
'title' => 'Email',
'value' => set_value('regEmail')
);
$regFname = array(
'name' => 'regFname',
'id' => 'regFname',
'title' => 'First name',
'value' => set_value('regFname')
);
$regLname = array(
'name' => 'regLname',
'id' => 'regLname',
'title' => 'Last name',
'value' => set_value('regLname')

);
$regPwd = array(
'name' => 'regPwd',
'id' => 'regPwd',
'title' => 'Password'
);
$regConPwd = array(
'name' => 'regConPwd',
'id' => 'regConPwd',
'title' => 'Confirm Password'
);

$regRegister = array(
'name' => 'register',
'id' => 'register',
'value' => 'Register',
'title' => 'Register'
);
?&gt;
<tr>
<td align="left" valign="top" background="&lt;?php echo $base_url; ?&gt;images/middle_bg.gif"><table width="840" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" style="padding:5px 0 5px 10px;"><table width="386" border="0" cellspacing="0" cellpadding="0">
&lt;?php echo form_open($base_url . 'user/register'); ?&gt;
<tr>
<td width="102" height="25" align="left" valign="middle">Email address :</td>
<td width="204" height="25" align="center" valign="middle">&lt;?php echo form_input( $regEmail ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">First name:</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_input( $regFname ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Last name</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_input( $regLname ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Choose a password</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_password( $regPwd ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Re-enter password</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_password( $regConPwd ); ?&gt;</td>
</tr>


<tr>
<td height="25" align="center" valign="middle" colspan="2">&lt;?php echo validation_errors(); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">&lt;?php echo form_submit($regRegister); ?&gt;</td>
<td height="25" align="center" valign="middle">&lt;input type="reset" name="reset" value="reset" src="images/submit_button.gif" &gt;&lt;/td>
</tr>

&lt;?php echo form_close(); ?&gt;
</table>

In autoload.php i have made form and url helpers available, HERE IS CODE IN CONTROLLER
Code:
function index() {
        $this->load->view('header', $this->view_data);
        $this->load->view('footer', $this->view_data);
    }
    function login() {
        $this->load->library('form_validation');
        
        if($this->form_validation->run() == FALSE) {
            $this->load->view('header', $this->view_data);
            $this->load->view('footer', $this->view_data);
        }
        else {

        }
    }
    function register() {
    
        $this->load->library('form_validation');
        $arrValues = array();
        
        if($this->form_validation->run() == FALSE) {
            //$this->load->view('header', $this->view_data);
            $this->load->view('signup', $this->view_data);
            $this->load->view('footer', $this->view_data);
        }
        else {
          
            print_r( $arrValues );
            $this->load->model('user_model');

            
        }
#2

[eluser]Georgi Budinov[/eluser]
This is not a valid html structure. Fix it and everything will be ok. Inside table tag directly place only tr tags.
#3

[eluser]Anjith Kumar Garapati[/eluser]
[quote author="Anjith Kumar Garapati" date="1295038212"]Hi,

I have placed 2 forms in a same html page using form_open and form_close, Only one form is getting build and when ever i submit form both the forms are submitted to first mentioned action url in form_open. I have closed first form by using form_close(), before starting second form.

Here is the code in the view,
Code:
<table width="557" height="82" border="0" align="left" cellpadding="0" cellspacing="5">

&lt;?php
$username = array(
    'name' => 'txtEmail',
    'id' => 'txtEmail',
    'title' => 'Email',
    'value' => ''
);
$password = array(
    'name' => 'txtPassword',
    'id' => 'txtPassword',
    'title' => 'Password',
    'value' => ''
);
$submit = array(
    'name' => 'Login',
    'id' => 'Login',
    'title' => 'Login',
    'value' => 'Login'
);
?&gt;
&lt;?php echo form_open('user/login'); ?&gt;
    <tr>
        <td width="65" class="password">Email</td>
        <td width="18" class="password">:</td>
        <td width="120">&lt;?php echo form_input($username); ?&gt;</td>
        <td width="81" align="center" class="password">Password</td>
        <td width="16" class="password">:</td>
        <td width="108">&lt;?php echo form_password($password); ?&gt;</td>
        <td width="109" align="center">&lt;?php echo form_submit($submit); ?&gt;</td>
    </tr>
&lt;?php echo form_close(); ?&gt;
<tr><td width="100%">&lt;?php echo validation_errors();  ?&gt;</td></tr>
</table>
<table width="840" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8"></td>
</tr>
&lt;?php
$regEmail = array(
'name' => 'regEmail',
'id' => 'regEmail',
'title' => 'Email',
'value' => set_value('regEmail')
);
$regFname = array(
'name' => 'regFname',
'id' => 'regFname',
'title' => 'First name',
'value' => set_value('regFname')
);
$regLname = array(
'name' => 'regLname',
'id' => 'regLname',
'title' => 'Last name',
'value' => set_value('regLname')

);
$regPwd = array(
'name' => 'regPwd',
'id' => 'regPwd',
'title' => 'Password'
);
$regConPwd = array(
'name' => 'regConPwd',
'id' => 'regConPwd',
'title' => 'Confirm Password'
);

$regRegister = array(
'name' => 'register',
'id' => 'register',
'value' => 'Register',
'title' => 'Register'
);
?&gt;
<tr>
<td align="left" valign="top" background="&lt;?php echo $base_url; ?&gt;images/middle_bg.gif"><table width="840" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" style="padding:5px 0 5px 10px;"><table width="386" border="0" cellspacing="0" cellpadding="0">
&lt;?php echo form_open($base_url . 'user/register'); ?&gt;
<tr>
<td width="102" height="25" align="left" valign="middle">Email address :</td>
<td width="204" height="25" align="center" valign="middle">&lt;?php echo form_input( $regEmail ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">First name:</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_input( $regFname ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Last name</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_input( $regLname ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Choose a password</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_password( $regPwd ); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">Re-enter password</td>
<td height="25" align="center" valign="middle">&lt;?php echo form_password( $regConPwd ); ?&gt;</td>
</tr>


<tr>
<td height="25" align="center" valign="middle" colspan="2">&lt;?php echo validation_errors(); ?&gt;</td>
</tr>
<tr>
<td height="25" align="left" valign="middle">&lt;?php echo form_submit($regRegister); ?&gt;</td>
<td height="25" align="center" valign="middle">&lt;input type="reset" name="reset" value="reset" src="images/submit_button.gif" &gt;&lt;/td>
</tr>

&lt;?php echo form_close(); ?&gt;
</table>

In autoload.php i have made form and url helpers available, HERE IS CODE IN CONTROLLER
Code:
function index() {
        $this->load->view('header', $this->view_data);
        $this->load->view('footer', $this->view_data);
    }
    function login() {
        $this->load->library('form_validation');
        
        if($this->form_validation->run() == FALSE) {
            $this->load->view('header', $this->view_data);
            $this->load->view('footer', $this->view_data);
        }
        else {

        }
    }
    function register() {
    
        $this->load->library('form_validation');
        $arrValues = array();
        
        if($this->form_validation->run() == FALSE) {
            //$this->load->view('header', $this->view_data);
            $this->load->view('signup', $this->view_data);
            $this->load->view('footer', $this->view_data);
        }
        else {
          
            print_r( $arrValues );
            $this->load->model('user_model');

            
        }
[/quote]
#4

[eluser]cideveloper[/eluser]
There is so much wrong here but I will start with a major flaw in the HTML

From the code you showed here you have 4 table open tags and only 2 table close tags :gulp:

Also why in the world is a colon in its own td?

Code:
<td width="18" class="password">:</td>

Since you are developing the project, I assume from scratch I would suggest learning about designing without tables. It really makes a mess of your html. Tables are for tabular data not design.
#5

[eluser]Cristian Gilè[/eluser]
I'm not sure but, I think that, Anjith Kumar Garapati, has solved his problem.

http://ellislab.com/forums/viewthread/178215/

Cristian Gilè
#6

[eluser]Anjith Kumar Garapati[/eluser]
Hi,

The issue is solved, the html showed is part of the design code and it is just for practicing(learning code ignitier) I did not pay attension to those semi-colon in between td tags.


Regards,
Anjith




Theme © iAndrew 2016 - Forum software by © MyBB