Welcome Guest, Not a member yet? Register   Sign In
Rookie $_POST Question

Hey guys,

I have a form field that is filled dynamically by the database, like so:

<?php foreach($listing_q->result() as $sublist): ?>
  <input type="hidden" name="main_<?=$sublist->id; ?>" value="<?=$list->id; ?>" />
  <li>&lt;input type="checkbox" name="sub_&lt;?=$sublist-&gt;id; ?&gt;" id="&lt;?=$sublist->id; ?&gt;" /> &nbsp;&lt;?=$sublist->name; ?&gt;</li>
  &lt;? endforeach; ?&gt;
  &lt;!-- end for each subcategory --&gt;
<br /><br />
&lt;? endforeach; ?&gt;

Somehow, in the controller method it posts to, I need to loop through all of the sub_&lt;?=$sublist->id; ?&gt;. I'm not sure how to loop through all $_POST variables (if thats even possible).

Any help would be much appreciated.

[eluser]Eric Cope[/eluser]
While it may not be intelligent to do this;
foreach($_POST as $var)
You should consider using the validation library though.

Theme © iAndrew 2016 - Forum software by © MyBB