Page 1 of 1

How to show/hide a div after post

Posted: Mon Jun 21, 2010 1:55 am
by MU09
Hi Guys,

I'm very new to PHP. I've a quick Q..how can I show/hide a div(the div has id) in the code behide..I mean after posting the page.

Thanks,
M

Re: How to show/hide a div after post

Posted: Mon Jun 21, 2010 2:07 am
by Phoenixheart
In your PHP code, check for $_POST. If it's not empty, your page is posted. Set the div's display style to none then.

Re: How to show/hide a div after post

Posted: Mon Jun 21, 2010 2:28 am
by MU09
I understood what you said, but could you please tell me..how to access the element with ID..do we have getElementByID or $('#Id')..Jquery notation
and then, how can I set the css attribute.?? Please let me know?

Thanks Phoenixheart.

Re: How to show/hide a div after post

Posted: Mon Jun 21, 2010 10:28 am
by hider
Not 100% sure what you mean, but try this:

Code: Select all

<? if(isset($_POST['name-of-form'])) { ?>
<style type="text/css">
#id-of-div { display: none; }
</style>
<? } ?>