Welcome Guest, Not a member yet? Register   Sign In
Problem with tutorial
#1

Hi all,

I am new and I try to learn by doing tutorial from here: http://www.codeigniter.com/user_guide/tutorial and I meet problem, which I am not able to solve it.
I try to search here, but did not find it.
I am in part, where I create form
Code:
<?php echo form_open('news/create') ?>

<label for="title">Title</label>
<input type="text" name="title" />
<br />
<label for="text">Text</label>
<textarea name="text"></textarea>
<br />
<input type="submit" name="submit" value="Submit" />

</form>
If I load page with form, it looks:
Code:
<form action="ci/news/create" method="post" accept-charset="utf-8">

<label for="title">Title</label>
<input type="text" name="title">
<br>
<label for="text">Text</label>
<textarea name="text"></textarea>
<br>
<input type="submit" name="submit" value="Submit">

</form>
...but if I try to submit form, I am end on 404 page with address:
Code:
http://localhost/ci/news/ci/news/create
where
Code:
http://localhost/ci/
is root of my project.
...only one thing which I did differently in my project is, that I add rewrite condition to wipe out index.php from address, but even I add back, it does not work, it is same issue.

My routes.php looks same as in tutorial also.
In config.php I have
PHP Code:
$config['base_url'] = 'ci/';
$config['index_page'] = ''

Can somebody help me to understand, what is wrong?
Thank you for each help in advance PeterB
Reply
#2

Problem is in your usage of relative urls. Since you have CI in sub directory and links are relative to current url, it would nest deeper and deeper. If you are currently on page "http://localhost/ci/something" and link points to "ci/something2", browser tries to load "http://localhost/ci/something/ci/something2". If "http://localhost/ci/something/ci/something2" actually did exist and there was another link on this page pointing to "ci/something3", browser would try to load "http://localhost/ci/something/ci/something2/ci/something3".

Try to change base_url to absolute url
PHP Code:
$config['base_url'] = '/ci/'
Reply
#3

Thank you....

...I feel Blush now it works as expected

Thanks again
Reply




Theme © iAndrew 2016 - Forum software by © MyBB