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.
答案 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);
}