0

I have a javascript function that currently changes the Submit action based on value of a variable called currentVal. I do have a select within this form with an ID of TRADE_IN that I also want to pass to the next page. How do I alter/add to this javascript to also submit this form select into the url so I can perform a $trade = $_REQUEST['TRADE_IN']; on the next page as well?

function changeSubmit(currentVal, id) {
    if(currentVal < 5) {
        $('#avgSubmit'+id).val('myVolvo.php?plan=gold&age=1-4 years');
    } else if(currentVal >=5 && currentVal < 10) {
        $('#avgSubmit'+id).val('myVolvo.php?plan=gold&age=5-9 years');
    } else {
        $('#avgSubmit'+id).val('myVolvo.php?plan=gold&age=10 years');
    }
}
4

2 に答える 2

1

ジェイソンの答えはうまくいくかもしれません。$_SESSION 変数にも保存できます。

于 2012-10-11T15:36:17.573 に答える
0

私には、あなたは単にこれを持つことができるようです:

<form action="myVolvo.php" method="get">
    <input type="hidden" name="plan" value="gold" />
    <select name="age">
        <option value="1-4 years">1-4 years</option>
        <option value="5-9 years">5-9 years</option>
        <option value="10 years">10 years</option>
    </select>
</form>

必要に応じて、非表示の「計画」を表示フォーム要素にすることもできます。

これは理にかなっていますか、それとも何か不足していますか?

于 2012-10-11T15:35:39.063 に答える