I used to be good a this 20 years back ... but somehow there is no success today. What I want to do: use a form, a button with an onlclick event. Onclick then builds a URL using domain and sends params from the form as url params using ? and & .....
QUestion: how can I do this smart and short in 1 go?
(I vaguely recall that this.
worked in the past)
Url should be
If all fields empty: domain.com? or domain.com?shirt_generalfit=&shirt_size=
If 1 fields populatd: domain.com?shirt_generalfit638=&shirt_size=
Help appreciated
<form name="custom_form" >
<select id="shirt_generalfit" class="in-sentence">
<option value="" selected="selected"></option>
<option value="638">A</option>
<option value="639">B</option>
</select>
<select id="shirt_size" class="in-sentence">
<option value="" selected="selected"></option>
<option value="584">35</option>
<option value="283">36</option>
<input type="button" id="custom_form" onclick="alert(window.location='https://example.com?'.if(shirt_size.value){'shirt_size='.shirt_size.value})" value="Show results" />
</form>