Welcome Guest, Not a member yet? Register   Sign In
URL
#1

[eluser]Praveen A P[/eluser]
Hello,

I am trying out CI for the first time. SO if this sounds dumb, please bear with me and help me.

I have a controller, it points to first view page.

The first view page has a link to register, When i click on register, It comes back to the controller and from there, it is sent to the next view.

The next view has a form with fields to enter Username and Password, and a Register button. When I click on register, It displays 404 page.

Expected behaviour, I have and echo statement in the controller where it should go next, however, it does not go to that function.

Please help me.

Here is the code if it helps.



Controller Code

Code:
<?php


class Ts_start extends Controller {


    
    function Ts_start(){

        parent::Controller();

        $this->load->helper('url');

        $this->load->helper('form');
    }
    

    
    function index(){

        $this->load->view('ts_start_view');

    }



    function prepareRegister(){

        echo 'halwa...';

        $this->load->view('ts_prepareRegister_view');

    }



    function register(){

        echo 'doosra...';

        $this->load->view('ts_register_view');

    }

    function insertDB(){

        echo 'regestering...';

        $this->load->view('ts_register_view');

    }

}




First view page

Code:
<html>
<head>
<title>Stories</title>
</head>
<body>

<p>THIS IS THE SITE</p>

<p></p>

<p>&lt;?php echo anchor('ts_start/prepareRegister', 'Register');?&gt;</p>

&lt;/body&gt;
&lt;/html&gt;




This is the next view

Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Stories&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

<p>THIS IS THE SITE</p>

<p>&lt;?php echo form_open('ts_start/register');?&gt;</p>

    &lt;input type="text" value="" name="uName"&gt;&lt;/input>
    <p>&nbsp;</p>
    &lt;input type="password" value="" name="password"&gt;&lt;/input>
    <p>&nbsp;</p>
    &lt;input type="submit" value="REGISTER"&gt;&lt;/input>

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;



THIS IS THE VIEW THAT SHOULD BE DISPLAYED WHEN I SUBMIT THE FORM

Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Stories&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

<p>THIS IS THE SITE</p>

<p>USER REGISTRATION DONE.</p>


&lt;/body&gt;
&lt;/html&gt;


The Problem I am facing is that when I submit the form I get a 404 page not found error.


Also, when I see the URL it looks quite weired.

here it is:
Code:
http://localhost/ts/index.php/ts_start/index.php/ts_start/register

Is there some problem with the URL?

Please help me.
#2

[eluser]dbashyal[/eluser]
[quote author="Halwa Raj" date="1225182740"]Hello,

Also, when I see the URL it looks quite weired.

here it is:
Code:
http://localhost/ts/index.php/ts_start/index.php/ts_start/register

Is there some problem with the URL?

Please help me.[/quote]

check your base_url in config, what have you set?
#3

[eluser]Praveen A P[/eluser]
The base url is:

$config['base_url'] = "";

Earlier it was http://yoursite.com

So it was always trying to go to yoursite.com.

I just made it empty.

I have tried localhost/ts but to no avail.

Please help me.
#4

[eluser]dbashyal[/eluser]
$config['base_url'] = 'http://localhost/ts/';
#5

[eluser]Praveen A P[/eluser]
thanks alot man I was struck with this since yesterday.

These forums are indeed useful.
#6

[eluser]dbashyal[/eluser]
[quote author="Halwa Raj" date="1225190872"]thanks alot man I was struck with this since yesterday.

These forums are indeed useful.[/quote]

welcome mate.




Theme © iAndrew 2016 - Forum software by © MyBB