Im populating a form selected options via a mysql query.
The result looks something like this :
<form method="get" action="">
<select name="recordlabel" onChange="submit()">
<option selected="selected"></option>
<option value="1">COLUMBIA</option>
<option value="2">SONY</option>
<option value="3">EMI</option>
</select>
</form>
When I select an option, it automatically submits the form and looks like this:
http://www.mysite.com/?recordlabel=3
What i want is to use friendly url and should look like this:
http://www.mysite.com/recordlabel/emi.3
http://www.mysite.com/recordlabel/columbia.1
Now, i know that i need to use mode_rewrite… that i have no problemo and looks like this:
RewriteRule ^/recordlabel/.*\.([0-9]+)$ /mysite.com?recordlalel=$1 [L]
The part that i don’t get is how do i format the string so it looks like a friendly url onChange() How do i achieve that?
You would need to use javascript to submit your form instead of relying on native submit.
If you’re using jQuery, you can do this (untested):