Searching for a way to automatically get the name or id of a select box and use it to select the appropriate option from the url. Code given
<p>I have the following drop down list and selects the option based on the url e.g. www.domain.com/?car=Algema&amp;city=Paris</p>

<p>The problem is thatI have 104 different forms and some of them are containg more than one dropdownlist. It is impossible to replace them. Is there a way to replace the <code>$_GET['car']</code> with the <code>$_GET['get the name of select id or name automatically']</code> ?</p>

<p>Maybe a re-writing regex script that will replace all my php files?</p>

<pre><code>&lt;select name="car" id="car" class="select"&gt;
&lt;option value="Algema" &lt;?php echo $_REQUEST['car'] == 'Algema' ? 'selected="selected"' : '';?&gt;&gt;Algema&lt;/option&gt;
&lt;option value="Barkas" &lt;?php echo $_REQUEST['car'] == 'Barkas' ? 'selected="selected"' : '';?&gt;&gt;Barkas&lt;/option&gt;
&lt;option value="Cadillac" &lt;?php echo $_REQUEST['car'] == 'Cadillac' ? 'selected="selected"' : '';?&gt;&gt;Cadillac&lt;/option&gt;
&lt;/select&gt;
</code></pre>
