Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Let's try and break this down into parts. I hope I can help you out here.</p> <p>I'm assuming you're doing the following for the XSS Filtering with the second "TRUE" argument:</p> <pre><code>$user_group_profiles = $this-&gt;input-&gt;post('user_group_profiles', TRUE); </code></pre> <p>You can actually do the XSS filtering with the form validation rules, or if you prefer filter the post after the rules. See here for my preference:</p> <pre><code>$this-&gt;form_validation-&gt;set_rules('profile_name', 'Profile Name', 'xss_clean|trim|required'); </code></pre> <p>So with knowing that now, we can follow the CI convention for their Form Validation Library. It's not necessary to grab the post before using the Form Validation Library because it auto-detects I believe the POST data anyway by the field name. For example:</p> <pre><code>$this-&gt;form_validation-&gt;set_rules('profile_name', 'Profile Name', 'trim|required|xss_clean'); $this-&gt;form_validation-&gt;set_rules('birthdate', 'Birthdate', 'trim|required|xss_clean'); $this-&gt;form_validation-&gt;set_rules('height', 'Height', 'trim|greater_than[0]|numeric'); $this-&gt;form_validation-&gt;set_rules('weight', 'Weight', 'trim|greater_than[0]|numeric'); if ($this-&gt;form_validation-&gt;run() == FALSE) { $this-&gt;load-&gt;view('my_view_where_this_post_came_from'); } else { $profile_name = $this-&gt;input-&gt;post('profile_name'); //or if you prefer the XSS check here, this: //$profile_name = $this-&gt;input-&gt;post('profile_name', TRUE); $birthdate= $this-&gt;input-&gt;post('birthdate'); $height= $this-&gt;input-&gt;post('height'); $weight= $this-&gt;input-&gt;post('weight'); //$user_group_profiles = $this-&gt;input-&gt;post(); } </code></pre> <p>I hope this helps!</p> <p><strong>EDIT: I also just noticed this. If you're trying to grab the entire post array the code is:</strong></p> <pre><code>$user_group_profiles = $this-&gt;input-&gt;post(NULL, TRUE); // returns all POST items with XSS filter $user_group_profiles = $this-&gt;input-&gt;post(); // returns all POST items without XSS filter </code></pre> <p>Not:</p> <pre><code> $user_group_profiles = $this-&gt;input-&gt;post('user_group_profiles'); </code></pre> <p>A good help if you don't know your $_POST names or are confused, you can do this to see if that data is even there! Like this as your first line:</p> <pre><code>var_dump($_POST); exit(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload