문제

This question may sound banal, but I'm really new to php. I have:

<?php $kzl="pencho"; ?>

<a href="settings.php?var=$kzl">asdf</a>

in the script settings.php

<? echo &_GET['var']; ?>

and on the screen is printed kzl not the value in kzl, why ?

도움이 되었습니까?

해결책

You need to print value of $kzl in url. Use this;

<a href="settings.php?var=<?php echo $kzl;?>">asdf</a>

Or you can use;

echo '<a href="settings.php?var=' . $kzl . '">asdf</a>';

다른 팁

Its because you are not doing it the right way.

Do it:

 <a href="settings.php?var=<?php echo $kzl;?>">asdf</a>

You should call variable in PHP Block

<a href="settings.php?var=<?php echo $kzl; ?>">asdf</a>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top