PHP Form returning weird results in WordPress

0

I’m trying to make a drop down that links to the option once the user presses the submit button, but I’m getting weird results. It’s worth mentioning that this is in WordPress so I’m not sure if its affecting the results at all.

<form id="select-id">
<select name="page">
 <option >Select Area</option>
 <option value="/condo/etobicoke/">Etobicoke</option>
 <option value="/condo/toronto/">Toronto</option>
 <option value="/condo/north-york/">North York</option>
</select>

<input type="submit" value="Submit"">
</form>

<script> 
$('#select-id').submit(function(e) {
  e.preventDefault();
   url = $('#select-id').val();
   window.open(url);
});
</script>

The result for the first option is domainname.com?page=%2Fcondo%2Fetobicoke%2F
but I want domainname.com/condo/etobicoke/

Link: PHP Form returning weird results in WordPress
Source: Stack WordPress

Share.

About Author

Leave A Reply