CodeIgniter Forums
Form helper - form_open first param as array - 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 helper - form_open first param as array (/showthread.php?tid=52974)



Form helper - form_open first param as array - El Forum - 07-04-2012

[eluser]Unknown[/eluser]
Hello, CI developers!
In 'form' helper we have the function form_open($url, $params, $hidden)

Theoretically there should be possible to put $url as array, with url segments. This should work, because if $url is not a full url address, then helper uses site_url($action) (form_helper.php, line 55), which supports an array version.
Only the problem, why cannot we use this - strpos($action, '://') (form_helper.php, line 53) - strpos function can receive only string $action, not an array.

So, what do I offer:
instead of
Code:
if ($action && strpos($action, '://') === FALSE)
  {
   $action = $CI->config->site_url($action);
  }
Let`s use:
Code:
if ($action && (is_array($action) || strpos($action, '://') === FALSE))
  {
   $action = $CI->config->site_url($action);
  }

What do you think?
May be there is sense to put this little modification in the next CI releases?

Best Regards,


Form helper - form_open first param as array - El Forum - 07-04-2012

[eluser]Aken[/eluser]
You should create an issue or pull request on Github with your suggestion - that's the best place for actual feedback.


Form helper - form_open first param as array - El Forum - 07-05-2012

[eluser]Unknown[/eluser]
Hi, ok, thanks for the information. Could you please advice, how can I do it?


Form helper - form_open first param as array - El Forum - 07-05-2012

[eluser]Aken[/eluser]
https://github.com/EllisLab/CodeIgniter