在选择菜单中选择选项时发布表单

在选择菜单中选择选项时发布表单

问题描述:

Would that be possible? I have a game and a custom site with a simple forum made for it. A player can have several characters. So when they make a post in the forum they get to select wich character to post with.

Now the question is, could I instead of having a submit button, that when they select a character the form gets sent?

<form action="/post" method="post">
<table>
<th colspan="3">Post New Topic</th>

<tr>
<td class="bold">Subject:</td>
<td><input type="text" name="subject"></td>
</tr>

<tr>
<td class="bold">Message:</td>
<td><textarea name="message"></textarea></td>
</tr>
<tr><td>&nbsp;</td><td>

<tr>
<td class="bold">Post Topic</td>
<td>
<select name="character">
<option value="" selected>Choose character</option>
<? foreach($db->query("SELECT id, name FROM character WHERE player_id = $pid ORDER BY name ASC") as $row) echo '<option value="'.$row['id'].'">'.$row['name'].'</option>'?>
</select>
</td>
</tr>

</td>
</tr>
</table>
</form>

Instead of having a submit button, would It be possible that when you select a character, then post form?

To submit change on select

Change

<select name="character">

To

<select name="character" onchange="this.form.submit()">