use both html and php in echo and href line

前端 未结 3 1460
挽巷
挽巷 2021-01-17 01:19

I have the variable:

 $myvar = \'myarchive.pdf\';

How can I embedd it to this:

echo(\'  

        
相关标签:
3条回答
  • 2021-01-17 01:26

    You are not appending the variable to the string properly. Also you have to enclose nextpage.php?file=variable within quotes. But you are closing it before the variable name.

    <a href="nextpage.php?file=".'$myvar'.>
                               ^
    

    So try with

    echo('<tr> <td> <a href="nextpage.php?file='.$myvar.'"> download now </a> </td> </tr>');
    
    0 讨论(0)
  • 2021-01-17 01:42

    this should work. re-add your brackets if you must

    echo '<tr><td><a href="nextpage.php?file='.$myvar.'">download now</a></td></tr>';
    
    0 讨论(0)
  • 2021-01-17 01:51

    try this

    echo('<tr> <td> <a href="nextpage.php?file='.$myvar.'> download now </a> </td> </tr>');
    
    0 讨论(0)
提交回复
热议问题