CodeIgniter Forums
Link buttons not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Link buttons not working (/showthread.php?tid=72055)



Link buttons not working - farkash7 - 10-30-2018

Hi.
I followed the tutorial. 
I have done all the tasks up to this page.
For some reason when I try to submit this simple form the framework try to redirect me to this address: http://0.0.0.0/news/create, and this address not exist of course.
I added some record to my empty DB just to check if the other pages is working well and to test the links in the 'news' page.
When I try to press on one of the View_article links its also redirect me to the same strange address, http://0.0.0.0/news/Good-news for example.

When I inspect the web page code generated by the framework I can see that 
<?php echo site_url('news/'.$news_item['slug']); ?>

is translated to the previous address, http://0.0.0.0/news/Good-news for example, So for some reason the site_url method generate this address.




RE: Link buttons not working - dave friend - 10-30-2018

Probably due to the value assigned to $config['base_url'] in application/config/config.php
Read the comments in the file carefully and follow the directions.


RE: Link buttons not working - php_rocs - 10-30-2018

@farkash7,

What's your development stack? Are you using the most current version of CI? Is your code exactly like the tutorial code?


RE: Link buttons not working - farkash7 - 10-30-2018

Hi thank. It really was the config.php file.
I set the 'base_url' in the config.php file to my server ip (If someone is reading this thread in the future make sure you not forget the http:// prefix and the / suffix).
I also set the index page to the right value (empty string in my case because my server start file is set to index.php).

Now everything is working and I can continue with the tutorial.

Thank you very much guys!


RE: Link buttons not working - InsiteFX - 10-31-2018

This is basic CodeIgniter setup in the Users Guide.

You always set the base url in the config file to your site.