gpt4 book ai didi

php - PHP 的动态链接

转载 作者:行者123 更新时间:2023-11-30 22:35:01 25 4
gpt4 key购买 nike

这是我的问题,我是 php 的初学者,我坚持要放置一个页面,其中包含从带有类别的网格图像到带有该类别内容的图像网格的链接。例如,我有一个主页,其中显示了意大利、法国和中国的食谱,并显示了这些国家的国旗,如果访问者单击特定的国旗,该类别的食谱将出现在名为 category.php 的页面中。我正在使用 Mysql 数据库管理系统谁能告诉我如何处理这个问题。

这是我附带的链接示例:

<a href="<?php specialité?specialite=1 ?>"><img id="im" class="img-responsive img-circle" src="images/france.png"></a>

最佳答案

如下使用,

<a href="category.php?<?php echo specialité?specialite=1 ?>"><img id="im" class="img-responsive img-circle" src="images/france.png"></a>

然后

类别.php

    <?php

$specialité = $_POST['specialité'];

if(isset($_POST['specialité'])){

# call mysql using $_POST['specialité']
# select table and get country related page and load page
header("Location:your db_value");
}

或者如果你知道 POST id 使用 switch 运算符

switch($_POST['specialité']){
case 1:
//call mysql
break;
case 2:
//call mysql
break;
case 3:
//call mysql
break;
}

关于php - PHP 的动态链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32821500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com