Ullas Pv
Ullas Pv

Reputation: 5

I want to display the text within the <a href> tag, in the page that it redirects to

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.

Upvotes: 0

Views: 89

Answers (1)

Justinas
Justinas

Reputation: 43557

Pass data to URL as GET parameter:

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

In PHP:

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

Upvotes: 1

Related Questions