derrick1123 Posted September 21, 2008 Share Posted September 21, 2008 I have a forum that needs to be submitted on click. <form method=get> <select name=listen> <option value=<? echo $one; ?>>Charr Radio</option> <option value=<? echo $two; ?>>Metal</option> <option value=<? echo $three; ?>>Classic Rock</option> <input type=submit value=Listen> </select> </form> Needs to be something like? <form method=get> <select name=listen> <option value=<? echo $one; ?> type=submit>Charr Radio</option> <option value=<? echo $two; ?> type=submit>Metal</option> <option value=<? echo $three; ?> type=submit>Classic Rock</option> </select> </form> Quote Link to comment https://forums.phpfreaks.com/topic/125147-forum-auto-submiting-on-select/ Share on other sites More sharing options...
dropfaith Posted September 21, 2008 Share Posted September 21, 2008 Requires JavaScript, you create a submit function that you must attach to the SELECT onchange event. You should provide and an alternate for folks who have JavaScript disabled. try this <form method="POST" name="stats_order" action="members.php?view=stats"> <select name="order" onchange="this.form.submit()"> <option value="date_asc" selected>Date ASC</option> <option value="date_desc">Date DESC</option> <option value="name_asc">Name ASC</option> <option value="name_desc">Name DESC</option> <option value="rating_asc">Rating ASC</option> <option value="rating_desc">Rating DESC</option></select> <noscript><input type="submit" value="Submit"></noscript> </form> Quote Link to comment https://forums.phpfreaks.com/topic/125147-forum-auto-submiting-on-select/#findComment-646860 Share on other sites More sharing options...
haku Posted September 21, 2008 Share Posted September 21, 2008 Doesn't require javascript at all - the first method posted will work - kind of. Lots of syntax errors, but at its core, the theory is solid. You will need to add a name attribute to each of the submit buttons, then check to see if the post value of that name has been submitted on whatever page, and if it has, find out what the value is. Quote Link to comment https://forums.phpfreaks.com/topic/125147-forum-auto-submiting-on-select/#findComment-646925 Share on other sites More sharing options...
derrick1123 Posted September 21, 2008 Author Share Posted September 21, 2008 The first one I used the code on, didn't work. So the second one was just showing what I thought would work. I don't mind using java, I just don't really understand it. Quote Link to comment https://forums.phpfreaks.com/topic/125147-forum-auto-submiting-on-select/#findComment-646932 Share on other sites More sharing options...
haku Posted September 21, 2008 Share Posted September 21, 2008 I was wrong actually, this will require javascript if you want it to go on change. I didn't look closely enough at your code the first time. Put this in the javascript forum. Quote Link to comment https://forums.phpfreaks.com/topic/125147-forum-auto-submiting-on-select/#findComment-646953 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.