CodeIgniter Forums
form_open(), why always localhost - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: form_open(), why always localhost (/showthread.php?tid=51569)



form_open(), why always localhost - El Forum - 05-09-2012

[eluser]Unknown[/eluser]
I'm debugging a website on a local machine
in the view, I have a form
Code:
echo form_open('basicquery/result', $attributes);

but when I access the site from other machine, I received error"couldn't access localhost"
I "view the page source", found the url is always :
Code:
<form action="http://localhost/index.php/basicquery/result" method="post">

But, in some other place, I can simply use the relative path, like
Code:
< src="/js/jquery.js">

The file location is like the following structure:
.
|-- application
| |-- controllers
| | |-- basicquery.php
|-- js
| |-- jquery.js

where, in basicquery.php, I have the function "result"
Code:
function result() {
}

Could anyone tell me how to fix this? Thanks.


form_open(), why always localhost - El Forum - 05-09-2012

[eluser]vrencianz[/eluser]
Check your base_url in config.php. Leave it empty or use ip instead of 'localhost' in it.