Php 网页 link href
Php web link href
我已经制作了这段代码,它运行良好,但我需要如何在输出文件上创建 link(href)。
我尝试了几种方法,但我就是不能,不需要答案,但需要一些学习的指导。
if ($row = mysqli_fetch_array($result)) {
$output = $row["id"];
}
if ($output) {
echo $output;
}
else {
echo "That is not a valid record on our database";
}
您应该只用您的 $output
回显锚标记
$output = $row["title"];
$output ='FirstSong'; #To test i am using this as FirstSong
echo "<a href='songs?id=".$output."'>Click here</a>"; #You can have any text for href
因此您的代码将是
if ($row = mysqli_fetch_array($result)) {
$output = $row["title"];
}
if ($output) {
echo "<a href='songs?id=".$output."'>Click here</a>";
}
else { echo "That is not a valid record on our database"; }
这里是demo
我已经制作了这段代码,它运行良好,但我需要如何在输出文件上创建 link(href)。 我尝试了几种方法,但我就是不能,不需要答案,但需要一些学习的指导。
if ($row = mysqli_fetch_array($result)) {
$output = $row["id"];
}
if ($output) {
echo $output;
}
else {
echo "That is not a valid record on our database";
}
您应该只用您的 $output
$output = $row["title"];
$output ='FirstSong'; #To test i am using this as FirstSong
echo "<a href='songs?id=".$output."'>Click here</a>"; #You can have any text for href
因此您的代码将是
if ($row = mysqli_fetch_array($result)) {
$output = $row["title"];
}
if ($output) {
echo "<a href='songs?id=".$output."'>Click here</a>";
}
else { echo "That is not a valid record on our database"; }
这里是demo