Welcome Guest, Not a member yet? Register   Sign In
get wrong url in form and links
#1

[eluser]Unknown[/eluser]
hey, I have to admit that I'm totally new to CodeIgniter and decided to start following those tutorials videos that can be found on CodeIgniter webpage.

But there is a one small thing that I just can't get to work:

in the "blog" tutorial everything works perfekt at the first page where it lists all the blogs that exist in the database, that's great, then I click on "comment" at any of the blog and that direct me to the right page (http://localhost/codeigniter_1.5.4/index...comments/1).

But if I try to submit a comment or even try to add link on the comment page then I always get some wrong url in the addressbar:

f.ex.

I want to submit a comment, then I use: <?=form_open('blog/comment_insert');?> ......
but the page I'm then submittet to is

http://localhost/codeigniter_1.5.4/index...ent_insert

instead of

http://localhost/codeigniter_1.5.4/index...ent_insert

Can anyone help me with this one ?
#2

[eluser]gunter[/eluser]
do you have the correct base url in your config.php?
Code:
$config['base_url']    = "http://localhost/codeigniter_1.5.4/";

$config['index_page'] = "index.php";
#3

[eluser]Unknown[/eluser]
crap, ofcourse not, had the index page but of some reason not the base_url.....

thanks man!
#4

[eluser]bijon[/eluser]
you add the url helper in the 'config/autoload.php'

$autoload['helper'] = array('url');

then you can edit these lines :

$url=site_url();
<?=form_open('$url/blog/comment_insert');?>

or u may be try this one :

<?=form_open('site_url()/blog/comment_insert');?>

Thanks
Saidur Rahman




Theme © iAndrew 2016 - Forum software by © MyBB