在我的情况下,请给我一些热点来获取身份证号码。
我将此脚本放在一个文件中。我需要的是,它按下按钮follow
发送用户uder的id号码。我们可以在$row['id']
中找到此ID,但我不知道如何将其发送到另一个脚本lib/follow.php
。
<?php
$users = mysql_query("SELECT * FROM 111212_users");
while($row = mysql_fetch_array($users)){
// $_SESSION['f_id'] = $row['id'];
echo "------------------------------------";
echo "<li>Full name: ".$row['name']."</li><li>Nickname: " .$row['nickname']."</li><li><form action='lib/follow.php' method='get'><input type='submit' name='follow' value='Follow'><form></li>";
}
?>
lib/follow.php
脚本。如果已发送
<?php
session_start();
include "connect.php";
if(isset($_GET["follow"])){
if(isset($_SESSION["f_id"])){
$followed = $_SESSION["f_id"];
$follower = $_SESSION['userId'];
$sql = "INSERT INTO 111212_follow (followed,follower) VALUES ('$followed','$follower')";
if (!mysql_query($sql)){
die('Error: ' . mysql_error());
}
header('Location: ../main.php');
}
}
?>
答案 0 :(得分:0)
您可以使用锚标记来获取值
echo "<li><a href="lib/follow.php?id=$row['id']">Full name: ".$row['name']."</a></li>"
答案 1 :(得分:0)
send using "<form action='lib/follow.php?followed=".$row['id']."' method='get'>
Receive using $followed = $_GET['followed'];
Else
Any how ur getting using session
$followed = $_SESSION["f_id"];
set the id in session
session_start();
// store/set session data
$_SESSION['f_id']=$row['id'];