Combine $_GET variables before Submit [closed]

2020-05-10 07:44发布

I am not really sure if this is possible but here is the problem I cant figure out.

Have a from that results in the this link.

End result Link.

http://www.website.com/index.php?a=price_range_A_B

I can not use a from but i can use Input fields. Any ideas?

标签: php html forms get
1条回答
看我几分像从前
2楼-- · 2020-05-10 08:29

EDIT : Since the OP changed the question I have updated my answer below.

I am putting an example of how you could do this.

<?php  
    $action_path = "index.php";
    ?>

    <script type="text/javascript">
        function submitData() {
            var a = null;
            var _A = document.getElementById("_A").value;
            var _B = document.getElementById("_B").value;

            a = "price_range_" + _A + "_" + _B;

            window.location.href = "<?php echo $action_path; ?>?a=" + a;

            return;
        }
    </script>

    <input type="text" id="_A" maxlength="6" size="5" />
    <input type="text" id="_B" maxlength="6" size="5" />
    <input type="button" value="Submit" onclick="submitData();" />

    <?php
    // the code to be put after </form> goes here
?>
查看更多
登录 后发表回答