Reputation: 55
This is my code:
<form action="" method="GET">
<input type="hidden" value=" <?php echo $category1; ?> ">
<input type="hidden" value=" <?php echo $category2; ?> ">
<select onchange="this.form.submit()" name="sortby">
<option value="popularity">Popularity</option>
<option value="release_dateo" >Release Date: Oldest</option>
<option value="vote_count" >Number Of Votes</option>
</select>
</form>
I am using this form because, i want to submit the form without submit button.
What this code do:
It submits the <option>
value, if someone click on an option.
What I want it to do:
If someone click on <option>
, if sends option value + the hidden values.
The url is something like this before submitting the form:
index.php?category1=abc&category2=xyz&sortby=selectedoptionvaluehere
Upvotes: 1
Views: 2336
Reputation: 1688
You are missing name
attribute at hidden input's to be sent..
<input type="hidden" name="category1" value=" <?php echo $category1; ?> ">
<input type="hidden" name="category2" value=" <?php echo $category2; ?> ">
Upvotes: 5