[英]Html how send data from one page to another page
I have a page name index.php
In page index.php there is many url like我有一个页面名称
index.php
在页面 index.php 中有很多 url 之类的
http://index2.php?user=2 , http://index2.php?user=3 and so on.On my local host there is a page name index2.php
and there is a text box with name user. http://index2.php?user=2 , http://index2.php?user=3 and so on.On my local host there is a page name
index2.php
and there is a text box with name user. I want whenever someone click on http://index2.php?userid=2
on page one it automatically fill the data on next page input text with 2
我希望每当有人在第一页点击
http://index2.php?userid=2
时,它会自动用2
填充下一页输入文本上的数据
When routing to the URL http://index2.php/?user=2
, you can access the GET superglobal values as follows:路由到 URL
http://index2.php/?user=2
时,您可以访问 GET 超全局值,如下所示:
<?php $selected_user = $_GET['user'];/>
If you want this to be the value of your input you could do the following:如果您希望这是您输入的值,您可以执行以下操作:
<input type="text" value="<?php echo $selected_user;?>">
Use Ajax to send data from one page to another.使用 Ajax 将数据从一页发送到另一页。
On Index.php Page在索引.php 页
$user=$_GET['user'];
$.ajax({
type: 'POST',
url: 'next_page.php',
data: { user: <?php echo $_GET['user']; ?> },
success: function(response) {
}
});
On next_page.php在 next_page.php
$user= $_POST['user'];
echo $user;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.