More logical order
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index f28296c..6fca73f 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -54,6 +54,17 @@
{
$CI =& get_instance();
+ // If an action is not a full URL then turn it into one
+ if ($action && strpos($action, '://') === FALSE)
+ {
+ $action = $CI->config->site_url($action);
+ }
+ elseif ( ! $action)
+ {
+ // If no action is provided then set to the current url
+ $action = $CI->config->site_url($CI->uri->uri_string());
+ }
+
$attributes = _attributes_to_string($attributes);
if (stripos($attributes, 'method=') === FALSE)
@@ -66,17 +77,6 @@
$attributes .= ' accept-charset="'.strtolower(config_item('charset')).'"';
}
- // If an action is not a full URL then turn it into one
- if ($action && strpos($action, '://') === FALSE)
- {
- $action = $CI->config->site_url($action);
- }
- elseif ( ! $action)
- {
- // If no action is provided then set to the current url
- $action = $CI->config->site_url($CI->uri->uri_string());
- }
-
$form = '<form action="'.$action.'"'.$attributes.">\n";
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites