新手求教:php页面中链接点击后网址后面会增加参数怎么弄的

新手求教:php页面中链接点击后网址后面会增加参数怎么弄的,第1张

a链接上加 特殊字符 "#"才会自动加载到当前a连接上;

看到这个问题,使用 js:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

</head>

<body>

<a href="javascript:" flag="包邮">包邮</a>

<script type="text/javascript" src="http://static.takungpao.com/js/jquery.1.9.min.js"></script>

<script type="text/javascript">

$(function(){

var win_href=window.location.href,go_href,temp_zf

$("a").each(function(){

$(this).bind("click",function(){

var temp_text=$(this).attr("flag")

win_href.indexOf("?")>0?temp_zf="&":temp_zf="?"

go_href=win_href+temp_zf+temp_text

window.location.href=go_hrefreturn

})

})

})

</script>

</body>

</html>

你空上都已经有参数了 还要什么参数输入框?

<form action="user.php" method="post">

<input class="inputtext" name="ac" type="text">

<input class="inputtext" name="gold" type="text">

<input type="submit" value="打开最终网址" class="button" />

</form>

?>

<!DOCTYPE html>

<html lang="en">

<body>

<button type="button"><div id="buttonValue" onclick="add()">0</div></button>

<div id="test"></div>

<script src="../js/jquery-2.1.4.js"></script>

<script>

    var a = 0

    function add() {

        a++

        $.ajax({

            type: 'GET',

            url: 'do.php',

            data: {

                param: a

            },

            success:function (response) {

                $("#buttonValue").html(a)

                $("#test").html(response)

            }

        })

    }

</script>

</body>

</html>

以上是test.php

$a = $_REQUEST["param"]

echo $a

以上是do.php

do.php接收参数后根据你的需求处理数据就好了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11597227.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存