У меня есть 3 формы и флажок, как это:
<input type="checkbox" name="confirm_agreement" value=yes <?php if (isset($_POST["confirm_agreement2"])) {print "checked";}?>>I agree
<form action="https://www.paypal.com/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_US/x-click-but02.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="paypal@exploretalent.com">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note2" value="1">
...
<input type="hidden" name="sra" value="1">
</form>
<form action="https://www.paypal.com/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_US/x-click-but02.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="paypal@exploretalent.com">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note2" value="2">
...
<input type="hidden" name="sra" value="2">
</form>
<form action="https://www.paypal.com/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_US/x-click-but02.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="paypal@exploretalent.com">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note2" value="2">
...
<input type="hidden" name="sra" value="2">
</form>
Я пытаюсь подтвердить, что пользователь нажимает на этот флажок, чтобы отправить любую из этих 3 форм.
если пользователь не установит флажок, появится предупреждение.
Я знаю, что мне нужно использовать какой-нибудь java-скрипт, например:
function checkCheckBoxes() {
if (document.frmTest.confirm_agreement.checked == false)
{
alert ('You must agree with the User Agreement Terms!');
return false;
}
}
затем добавьте onsubmit="return checkCheckBoxes();"
в формы, но это не сработает.
Есть идеи, как это сделать?
Спасибо