How to display hidden value in form based on selection?

JakeIsChill

New Member
I'm using a custom search where I have a dropdown:\[code\]<select name='Time_Available'> <option value="" selected='true'>Any</option> <option value='http://stackoverflow.com/questions/3859581/<?php echo date('Y/m/d', strtotime('+30 days')) ?>'>30 days</option> <option value='http://stackoverflow.com/questions/3859581/<?php echo date('Y/m/d', strtotime('+60 days')) ?>'>60 days</option> <option value='http://stackoverflow.com/questions/3859581/<?php echo date('Y/m/d', strtotime('+90 days')) ?>'>90 days</option> </select>\[/code\]Although, when the form is submitted, if the "Any" option is selected, I would like it to add this to the form:\[code\]<input type='hidden' name='Model' value='http://stackoverflow.com/questions/3859581/Yes' />\[/code\]For the rest of the options (30, 60, 90 days) I just want it to submit regularly without the above part. I was trying to work around this by adding \[code\]&Model=Yes\[/code\] to the value of "Any" although the ampersand gets screwed up. Is there any javascript or jQuery I can add to resolve this?
 
Back
Top