简体   繁体   English

在php代码中包含html标记,专门处理php块内的href函数

[英]including html tag in a php code, specifically dealing with href function inside a php block

enter the html code once a condition is satisfied but then i aim to use php values and html tags together. 一旦满足条件,请输入html代码,但是我的目标是一起使用php值和html标签。

tried tag etc and got most of the part in running just unable to deal with href beacuse it is referencing to some values. 尝试标签等,并获得了运行中的大部分功能,因为它引用了一些值,因此无法处理href。 not sure where to use "" or ``. 不知道在哪里使用“”或“。

<?php.....        
echo `<a href="limitdatabase.php?Dropdown=.$_GET[Dropdown].;&search= $search_name;&wise=$_GET[wise];">Yes</a>`;

?> 

"yes" should work as a hyperlink but at the moment the php values are not processed that`s why no result. “是”应该作为超链接工作,但是目前没有处理php值,这就是为什么没有结果的原因。

You are using wrong sequence of quote 您使用了错误的报价顺序

<?php

  ...

?>

<?php
  echo '<a href="limitdatabase.php?Dropdown=' .
         $_GET['Dropdown'].
         ';&search='. 
         $search_name .
         ';&wise='.
         $_GET['wise'].
         ';">Yes</a>';

?>

and you should use single quote and not backtics for string 并且您应该对字符串使用单引号而不是反斜线

You are using incorrect concatenation. 您使用的连接不正确。 Whenever you want to add any PHP variable then you need to close the braces and need to start after PHP variable as below: 每当您要添加任何PHP变量时,都需要关闭花括号并需要在PHP变量之后启动,如下所示:

<?php 
echo '<a href="limitdatabase.php?Dropdown='.$_GET['Dropdown'].'&search= '.$search_name.'&wise='.$_GET['wise'].'">Yes</a>';
?>

Also you should wrap Dropdown and wise in braces as it will not work directly in get as you have used. 另外,您还应该将Dropdownwise用大括号括起来,因为它不能像使用过的那样直接在get中起作用。 Hope it helps you! 希望对您有帮助!

You can use combination of html with php inside: 您可以在内部使用html和php的组合:

<a href="limitdatabase.php?Dropdown=<?PHP echo $_GET[Dropdown] . "&search=" 
 . $search_name . "&wise=" . $_GET[wise]; ?>">Yes</a>

Also, you can input whole link in string: 另外,您可以在字符串中输入整个链接:

<?php
$mylink = "limitdatabase.php?Dropdown=" . $_GET[Dropdown] . "&search=" . $search_name . "&wise=" . $_GET[wise];
?>
<a href="<?PHP echo $mylink; ?>">YES</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM