Hide HTML Tag's with PHP event(solved)

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
Cakey
Forum Newbie
Posts: 6
Joined: Thu Mar 26, 2009 7:45 pm

Hide HTML Tag's with PHP event(solved)

Post by Cakey »

So I just cannot seem to figure this out. Maybe I am attacking it wrong.

I tried using an if statement and an Echo, and it displayed everything very skewed and wouldn't use my inner PHP functions. So I am at a loss of ideas.

Code: Select all

 
<?php 
    if( is_in_market() ){
        ?>
<div class="col1">
    <p>Search for a item:</p>
    <form style="margin-bottom:0;margin:0;" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
      <input class="postform" type="text" name="s" value="Search for something" onfocus="this.value='',this.style.backgroundColor='#fff'" onblur="this.style.backgroundColor='#fff'" size="42" id="search_input" />
      <input type="image" src="<?php bloginfo('template_directory'); ?>/imgs/sf.png" value="Search" alt="Search" title="Search" />
    </form>
  </div>
        <?php
    }
?>
The idea is if the php function returns true then to display the following form and let it function.

could I just use the Include function, and put the HTML form stuff in a separate file?

Any ideas peoples? :o


----
Edit:
Using the Include function seems to solve this.
Last edited by Benjamin on Mon May 11, 2009 5:59 pm, edited 1 time in total.
Reason: Changed code type from text to php.
ldougherty
Forum Contributor
Posts: 103
Joined: Sun May 03, 2009 11:39 am

Re: Hide HTML Tag's with PHP event(solved)

Post by ldougherty »

Your code works fine for me.. Ofcourse I had to remove the function reference since it doesn't exist on my test page.

I replaced this

if( is_in_market() ){

With

if( 1==1 ){

And the script works fine.

If it's not working for you and you're not getting any errors you likely don't have PHP errors enabled. Try adjusting your if statement to match mine and see if that works to eliminate your function call.
Post Reply