how to hide div with link text
for example : if my link is https://host/index.php?hide=yes ,
the </div>
should be hidden…
and
if my link is https://host/index.php?hide=no ,
the </div>
should be shown…
is there any way ?
for example : if my link is https://host/index.php?hide=yes ,
the </div>
should be hidden…
and
if my link is https://host/index.php?hide=no ,
the </div>
should be shown…
is there any way ?
if ($_REQUEST['hide']=='no' ) {
echo '</div>';
}
what should i do to show again ?
What i’ve given you is an example code, I wouldn’t be surprised if you’ve pasted that exact code there.
It must look like that:
if ($_REQUEST['hide'] != 'yes' ) {
echo 'your div element goes here';
}
.that’s why! iam a biginner…
so my doubt is can i mention a class or id
The content between the quotes can be any HTML content. The PHP code just sends whatever comes after the echo
statement between quotes to the browser. So it could easily be multiple lines with multiple HTML tags with attributes, values and whatnot.
i have a <div>
it is hidden by defult (CSS).
and also i have a button , that help to show this div,
but i need -
if i visit https://host/page.html don’t show this div and
if i visit https://host/page.html#showDiv the div must be shown …
is there any way ??
So what’s your site url?
in this way i could’nt show the popup
<html>
<head>
</head>
<style>
if ($_REQUEST['hide']=='no' ) {
echo '.hiddenDiv{display:block;}';
}
</style>
<body>
<div style="display:none;" class="hiddenDiv"> <p> somthing here...</p>
</div>
</html>
NOT WORKING…
is there any way to click button using url ?
please explain how it does not show.
i just tried like this…
i don’t know is this wrong or good , but it not working …
You don’t put PHP code in HTML’s <style></style>
section.
You either make a separate PHP file and call it or if you want it to be in the HTML file, you put it like so:
<?php
// PHP code goes here
?>
Could you please answer my another question. ???
This is my question .
https://forum.infinityfree.net/t/how-to-run-php-codes-in-html-files-using-htaccess/37015
The #showDiv
makes this really hard. That part (the anchor tag) is not accessible from PHP code. Maybe it’s accessible with CSS, and it’s definitely accessible with Javascript, but not with PHP.
So, to fix this, you need to:
page.html
to page.php
(otherwise the PHP code won’t be executed).This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.