如何在PHP中超链接datalist元素? [英] How to hyperlink datalist elements in php?

查看:81
本文介绍了如何在PHP中超链接datalist元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在datalist选项中添加anchore标签。

我很简单地添加一个锚标签,但它没有重定向到特定位置。

下面是我的代码

I want add anchore tag in datalist option.
I am simple adding a anchor tag but its not redirection to specific location.
Below is my code

<input list="plants" placeholder="Search" name='search' style='width:400px;'/>
                            <datalist id='plants'>
                            <?php

                                $query_plants=mysql_query("select plant_id,plant_name from plants where status='plant'");

                                while($get_query=mysql_fetch_array($query_plants))

                                {

                                    $x=$get_query[0];

                                    $y=$get_query[1];

                                    echo"<a href='view/product-details.php?id=$x'><option value='$y'>$y</option></a>";
                                }
                            ?>
                            </datalist>





请帮忙解决这个问题



Please help to solve this

推荐答案

query_plants = mysql_query( select < span class =code-summarycomment> plant_id,plant_name 来自 plants 其中 status =' plant' );

< span class =code-summarycomment> while(
query_plants=mysql_query("select plant_id,plant_name from plants where status='plant'"); while(


get_query = mysql_fetch_array(
get_query=mysql_fetch_array(


query_plants))

< span class =code-summarycomment> {

< span class =code-summarycomment>
query_plants)) {


这篇关于如何在PHP中超链接datalist元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆