Stefany93 Posted May 21, 2014 Share Posted May 21, 2014 (edited) I have this form <form action="" method="get" name="size"> Størrelse <hr><label><input type="radio" value="9" name="size" onchange="this.form.submit()">92 (2år)</label> <label><input type="checkbox" value="147" name="size" onchange="this.form.submit()">68 (6-9 mdr.) </label><label><input type="checkbox" value="150" name="size" onchange="this.form.submit()">86 (18-24 mdr.)</label> <input type="checkbox" value="149" name="size" onchange="this.form.submit()">80 (12-18 mdr.)</label> <label><input type="checkbox" value="148" name="size" onchange="this.form.submit()">74 (9-12 mdr.)</label> </form> I want to make it so that when the user clicks one checkbox for example size 68 and then checks size 80 I want both sizes to be in the URL query string. But every time the user clicks a new checkbox, the query string changes accordingly. Maybe with a separator like ?size=4:23 and then I will handle it with the DB stuff. Please tell me how to add multiple elements in the query string with this form, thank you! Edited May 21, 2014 by Stefany93 Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted May 21, 2014 Share Posted May 21, 2014 (edited) you would use an array for the name attribute - name="size[]" you would also output the checked keyword for any checkbox that has already been checked, which would generally lead to using php to dynamically produce the form, rather than you hard-coding each form element. Edited May 21, 2014 by mac_gyver Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.