Jump to content

Forum - Auto Submiting on select


derrick1123

Recommended Posts

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>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.