I have a form that submits a large number of inputs...
<input type="hidden" name="searchTag_happy" value="0" />
<input type="hidden" name="searchTag_sad" value="0" />
<input type="hidden" name="searchTag_ambivalent" value="0" />
etc
.
.
.
The value attributes for these inputs can be either "0" or "1".
I would like to use this information to create an array "searchTags" that contains any attributes whose values are set to "1".
I'm wondering what is the most efficient, safe method for dealing with this in php. Currently I have a long list of if statements like so...
if ($_REQUEST['searchTag_happy']) $searchTagArray[] = "happy";
if ($_REQUEST['searchTag_sad']) $searchTagArray[] = "sad";
if ($_REQUEST['searchTag_ambivalent']) $searchTagArray[] = "ambivalent";
etc
.
.
.
But that seems very verbose. Is there a better alternative?
Thanks in advance for your help.