How to show/hide a div after post

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MU09
Forum Newbie
Posts: 2
Joined: Mon Jun 21, 2010 1:36 am

How to show/hide a div after post

Post 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
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Re: How to show/hide a div after post

Post 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.
MU09
Forum Newbie
Posts: 2
Joined: Mon Jun 21, 2010 1:36 am

Re: How to show/hide a div after post

Post 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.
hider
Forum Newbie
Posts: 7
Joined: Fri Jun 18, 2010 9:11 am

Re: How to show/hide a div after post

Post 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>
<? } ?>
Post Reply