从php中具有相同名称的按钮获取id
所以我有一个网站,只要数据库中有记录,它就会在数据库上运行一个循环。 它还在表中的每行中放置两个按钮。 每个按钮都有相同的名称。 如果我按下其中一个按钮,如何获取该按钮(指向数据库中的Youtube链接)的ID以包含在SQL查询中 这是我的密码:从php中具有相同名称的按钮获取id,php,html,mysql,button,Php,Html,Mysql,Button,所以我有一个网站,只要数据库中有记录,它就会在数据库上运行一个循环。 它还在表中的每行中放置两个按钮。 每个按钮都有相同的名称。 如果我按下其中一个按钮,如何获取该按钮(指向数据库中的Youtube链接)的ID以包含在SQL查询中 这是我的密码: <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="style.c
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ruben MediaShare</title>
</head>
<body>
<form method='POST'>
<?php
session_start();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
echo "Welcome to the member's area, " . $_SESSION['modname'] . "!";
} else {
echo "Please log in first to see this page.";
}
$link = mysqli_connect("localhost", "asd", "asd", "mediareq");
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$sql = "SELECT * FROM requests";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
echo "<table>";
echo "<tr>";
echo "<th>link</th>";
echo "<th>Twitch Név</th>";
echo "<th>Üzenet</th>";
echo "<th>Engedélyezés</th>";
echo "<th>Elutasítás</th>";
echo "</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
$link = $row['link'];
echo "<td>" . "<iframe width='560' height='315' src='$link' frameborder='0' allowfullscreen></iframe>" . "</td>";
echo "<td>" . $row['ttvname'] . "</td>";
echo "<td>" . $row['msg'] . "</td>";
echo "<td>" . "<input type='submit' id='$link' value='' name='enable'></input>" . "</td>";
echo "<td>" . "<input type='submit' id='$link' value='' name='eject'></input>" . "</td>";
echo "</tr>";
}
mysqli_free_result($result);
if (isset($_POST['enable'])) {
$ID = $_POST[$link];
echo $ID;
}
} else{
echo "Még nem kaptál videót, várjál már egy kicsit vagy csak tolj egy F5öt Pog Pog Pog";
}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
mysqli_close($link);
?>
</form>
</body>
</html>
鲁本媒体共享
这回答了你的问题吗?