CodeIgniter Forums
problem with form_open() - 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: problem with form_open() (/showthread.php?tid=2524)



problem with form_open() - El Forum - 08-10-2007

[eluser]freak131[/eluser]
if i use the form_open function, don't will get the right link, it just put it on the normal url, just remove the old (function, and class).

is it s bug ?

sorry for my bad english.


problem with form_open() - El Forum - 08-10-2007

[eluser]Phil Sturgeon[/eluser]
The way form_open() works is so you can give it a controller and it will make it into a local site url. In the helper the code is this:

Code:
$form = '<form action="'.$CI->config->site_url($action).'"';

If you want to create a form to an external location, just use HTML:

Quote:<form action="http://google.com" method="post">



problem with form_open() - El Forum - 08-10-2007

[eluser]freak131[/eluser]
if i use $this->data['someContent'] .= '<form action="'.$CI->config->site_url("welcome/login").'"';

on this url


CodeIgniter_1.5.4/index.php/welcome/login_form


codeigniter navigate me to

CodeIgniter_1.5.4/index.php/welcome/index.php/login


problem with form_open() - El Forum - 08-10-2007

[eluser]Phil Sturgeon[/eluser]
If only you could understand what I am typing.

Use:

Quote:$this->data[’someContent’] .= ‘<form action="http://google.com" method="post">’;



problem with form_open() - El Forum - 08-10-2007

[eluser]freak131[/eluser]
but i dont want to navigate trough my CI with absolute paths.

i don't can use relative paths to jump throug the functions ?


problem with form_open() - El Forum - 08-10-2007

[eluser]Phil Sturgeon[/eluser]
I thought you didnt want to. In that case just use:

Code:
<?=form_open('controller/method');?>



problem with form_open() - El Forum - 08-10-2007

[eluser]freak131[/eluser]
[quote author="thepyromaniac" date="1186765251"]I thought you didnt want to. In that case just use:

Code:
<?=form_open('controller/method');?>
[/quote]

thats my problem, if i use it, the link isnt right....

pour example i use it on welcome/login, i write: $this->data['someContent'] .= '<form action="'.("welcome/login").'"';

if i click on the submit button im on the page

CodeIgniter_1.5.4/index.php/welcome/index.php/login

the second index.php is wrong, it's a 404 page =(


i hope now you understand me, i am very sorry for my bad english,
nice greez from germany.


problem with form_open() - El Forum - 08-10-2007

[eluser]sikkle[/eluser]
What does your config/routes.php show ?


problem with form_open() - El Forum - 08-10-2007

[eluser]Michael Wales[/eluser]
Code:
$this->data[’someContent’] .= ‘<form action=“‘.("welcome/login").‘“’;

That's wrong - you are not including any sort of function for the framework to know what you want it to do with the path.

First, I would just place this directly in my view - rather than passing it from my controller. Is there a reason you want to pass it from the controller?

If placed in view:
Code:
&lt;?= form_open('welcome/login'); ?&gt;

If in controller:
Code:
$data['open_Form'] = form_open('welcome/login');

If you get the wrong URL after that - please tell us what the URL you are getting is. I guarantee it's an issue with your config.php (or maybe some crazy URI routing).