Possible Duplicate:
How can I split a comma delimited string into an array in PHP?
With the example URL format domain.com/?q[]=a_1&q[]=a_2&q[]=a_3
:
In select option I would retrieve the selected='selected'
using this code:
<option value="a_1"<?php if(isset($_GET['q'])) if (in_array('a_1', $_GET['q'])) { echo ' selected="selected"'; } ?>>
Sample 1
</option>
<option value="a_2"<?php if(isset($_GET['q'])) if (in_array('a_2', $_GET['q'])) { echo ' selected="selected"'; } ?>>
Sample 2
</option>
<option value="a_3"<?php if(isset($_GET['q'])) if (in_array('a_3', $_GET['q'])) { echo ' selected="selected"'; } ?>>
Sample 3
</option>
If the URL format were instead domain.com/?q=a_1,a_2,a_3
, how would I retrieve the selected value?