Welcome Guest, Not a member yet? Register   Sign In
form submit url is wrong, why is this?
#1

[eluser]anna16[/eluser]
hi guys

I have this simple form below.
http://coder9.com/ci/ztest.php/session/s...sion_view/

when you press the submit button, the url is like this below,
http://www.coder9.com/ci/session/validate_data

As you can see the ztest.php is missing.
Why is this?

Thanks in advanced.
#2

[eluser]InsiteFX[/eluser]
Hi Anna,

Did you try it without the .php extensions?

InsiteFX
#3

[eluser]anna16[/eluser]
@InsideFX

what do you mean by php extension?

I guess yes, and it say 'Not Found'.

Thanks in advanced.
#4

[eluser]anna16[/eluser]
By the way here is the form codes,
Code:
<head>
<title>My Form</title>
</head>
<body bgcolor="#666666">

<h2>Sesion Test.</h2>

<table  bgcolor="#FFFFFF"  cellspacing="6">
<tr><td>

&lt;?php echo form_open('session/validate_data'); ?&gt;

  <h4>Username</h4>
  &lt;input type="text" name="username" value="" size="50" /&gt;
  
  <h5>Email Address</h5>
  &lt;input type="text" name="email" value="" size="50" /&gt;
  
  <div>&lt;input type="submit" value="Submit" /&gt;&lt;/div>
  
&lt;?php echo form_close(); ?&gt;


</td></tr>>
</table>
&lt;/body&gt;
&lt;/html&gt;


And here is the controller codes below,
Code:
&lt;?php

class Session extends Controller
{
    function __construct()
    {
        parent::Controller();
        $this->load->library('session');
        $this->load->helper('form');
    }

  function session_view()
  {
    $this->load->view('session/session_form');  
  }

  // validate some data
    function validate_data()
    {
        $this->load->library('form_validation');
    
        if ($this->form_validation->run() == FALSE)
        {
            $this->load->view('session_form');
        }
        else
        {
      //load session
      $data = array(
                  'username'  => $_POST['username'],
                  'email'     => $_POST['email'],
                  'logged_in' => TRUE
               );

      $this->session->set_userdata($data);      
    
            $this->load->view('login_area');
        }      
  }
  
  function logout()
  {
    $this->session->sess_destroy();  
  }  
}
// end of site class

Thanks in advanced.
#5

[eluser]anna16[/eluser]
Okay I already fixed this.
But a new problem occur.

When you press the submit button it say,
Code:
404 Page Not Found
The page you requested was not found.

I wonder what's causing this?
#6

[eluser]anna16[/eluser]
Okay i also fixed the last problem.
No need to reply on this.




Theme © iAndrew 2016 - Forum software by © MyBB