CodeIgniter Forums
get wrong url in form and links - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: get wrong url in form and links (/showthread.php?tid=2906)



get wrong url in form and links - El Forum - 08-30-2007

[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.php/blog/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.php/blog/comments/index.php/blog/comment_insert

instead of

http://localhost/codeigniter_1.5.4/index.php/blog/comment_insert

Can anyone help me with this one ?


get wrong url in form and links - El Forum - 08-30-2007

[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";



get wrong url in form and links - El Forum - 08-30-2007

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

thanks man!


get wrong url in form and links - El Forum - 08-31-2007

[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