Welcome Guest, Not a member yet? Register   Sign In
application/config/config.php is not loading automatically
#1

[eluser]mohfeza code ignitor[/eluser]
I read the tutorial that "CodeIgniter automatically loads the primary config file (application/config/config.php), so you will only need to load a config file if you have created your own."

the below is my code-

My code:
<form id="search_form" method="post" action="<?php echo $base_url;?>index.php/amazon/search">

where $config['base_url']="http://mohfezalearningtools.com/codeIgnitor/"; in application/config/config.php

The Error I got:
A PHP Error was encountered
Severity: Notice

Message: Undefined variable: base_url

Filename: views/index.php

Line Number: 51

I got the above error message, but when i loaded config.php file manually, didn't get any error and working fine.

$this->config->load('config');
$base_url=$this->config->item('base_url');

My question is why config.php file needs to be loaded even though i have not add any additional stuff to it. Please reply me ASAP.
#2

[eluser]wiredesignz[/eluser]
The problem has nothing to do with config.php, You need to load the URL helper.

Could you please post in the appropriate forum next time, this forum is for people posting Job Vacancies etc.

Unless of course you wanted to pay for help. Tongue

Welcome to CI forums.
#3

[eluser]Derek Allard[/eluser]
Moved the thread. Welcome to CodeIgniter mohfeza. I hope a little over an hour was ASAP enough for you Wink




Theme © iAndrew 2016 - Forum software by © MyBB