我想在<a href=""> tag, in the page that it redirects to

时间:2016-04-19 12:58:48

标签: php html

The page I refer to, with the anchor tag, should display what I write within it. For eg:

echo "<a href='".$question."'>$question</a>"

should display the text in $question , as a text in the page that it links to.

How can i achieve this using php or html?

PS: I'm new to both php and stackoverflow! So any suggestions are welcome.

1 个答案:

答案 0 :(得分:1)

将数据作为GET参数传递给URL:

<a href="example.com?q=<?php echo urlencode($question); ?>"></a>

在PHP中:

if (isset($_GET['q'])) {
    echo htmlspecialchars($_GET['q'], ENT_QUOTES);
}