doujianmin6527 2013-07-08 03:10
浏览 85
已采纳

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

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?

  • 写回答

1条回答 默认 最新

  • doucheng5705 2013-07-08 03:21
    关注

    To submit change on select

    Change

    <select name="character">
    

    To

    <select name="character" onchange="this.form.submit()">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探