使用多个提交按钮自动提交表单

时间:2012-03-06 21:29:57

标签: javascript forms submit

我需要找到一种方法来使用javascript自动提交此表单以用于单个提交按钮,以便我能够执行以下操作:

thispage.php?go = gold - 当用户点击此页面时,会立即自动点击“金牌会员”的提交按钮(如果?go = gold在URL中)。

我不需要任何PHP帮助,只需提交Javascript即可提交特定的提交按钮。

if ($_GET['go'] == 'gold') {  
    '** need the code I would put here to auto submit the form for the gold button'
 }

(((为便于阅读而删除了格式)))

<form action="payments.php?do=order" method="post" name="MiFormulario">

<input type="hidden" name="s" value="" />

<input type="hidden" name="securitytoken" value="1331068360-a3bc1dae4834781f33c7100b66bade8f8d17fafd" />

<input type="hidden" name="do" value="order" />









<legend>Silver Membership</legend>


Cost:<br />

<select name="currency[4]" style="width:125px"><optgroup label="3 Months *">
<option value="0_usd" >US$597.00</option>
</optgroup>
</select>

<input type="submit" class="button" name="subscriptionids[4]" value="Order" style="font-weight:normal" />









<legend>Gold Membership</legend>



Cost:<br />

<select name="currency[3]" style="width:125px"><optgroup label="3 Months *">
<option value="0_usd" >US$997.00</option>
</optgroup>
</select>

<input type="submit" class="button" name="subscriptionids[3]" value="Order" style="font-weight:normal" />








<legend>Platinum Membership</legend>

Cost:<br />

<select name="currency[2]" style="width:125px"><optgroup label="6 Months *">
<option value="0_usd" >US$1,997.00</option>
</optgroup>
</select>

<input type="submit" class="button" name="subscriptionids[2]" value="Order" style="font-weight:normal" />








Cost:<br />

<select name="currency[1]" style="width:125px"><optgroup label="1 Year *">
<option value="0_usd" >US$50.00</option>
</optgroup>
</select>

<input type="submit" class="button" name="subscriptionids[1]" value="Order" style="font-weight:normal" />






</form>

1 个答案:

答案 0 :(得分:0)

echo "<script type='text/javascript'> $('formId').submit(); </script>";