Php href link question

rwxsu

Computer Engineer
Joined
Mar 31, 2018
Messages
67
Reaction score
83
Location
Jugoslavija
You should do this in JavaScript, not PHP; so you don't have to refresh the page on click.

Just style the <div> containing all the quest info hidden to begin with (with CSS), and make it visible on click (with JS).

Example:

HTML:
<button onclick="makeVisible()">Quest 1</button>
<div style="visibility:hidden;" id="quest_info">Your quest info goes here...</div>
<script>
function makeVisible()
{
    document.getElementById("quest_info").style.visibility = "visible";
}
</script>
Or if you're retrieving the quest info from a database/file, use AJAX.
 
OP
Tbol

Tbol

Member
Joined
Apr 7, 2019
Messages
45
Reaction score
6
You should do this in JavaScript, not PHP; so you don't have to refresh the page on click.

Just style the <div> containing all the quest info hidden to begin with (with CSS), and make it visible on click (with JS).

Example:
HTML:
<button onclick="makeVisible()">Quest 1</button>
<div style="visibility:hidden;" id="quest_info">Your quest info goes here...</div>
<script>
function makeVisible()
{
    document.getElementById("quest_info").style.visibility = "visible";
}
</script>
Or if you're retrieving the quest info from a database/file, use AJAX.
I prefer php more then js to be honest i know its better but i just like php more.
 

rwxsu

Computer Engineer
Joined
Mar 31, 2018
Messages
67
Reaction score
83
Location
Jugoslavija
I prefer php more then js to be honest i know its better but i just like php more.
Everyone has a language they like above all others, but in your case it does not come down to your preference.
Events/clicks are handled by JS wherever your like it or not (that's just how your browser is implemented).

Front-end: HTML, CSS and JS
Back-end: PHP, Java, C++, Go, etc...
 
Top