Welcome Guest, Not a member yet? Register   Sign In
Form helper - form_open first param as array
#1

[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,
#2

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB