can i get rid of a button after usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Toxicous8
    New Member
    • Oct 2015
    • 57

    can i get rid of a button after usage

    I wanted to make a "show comments" button to show comments which the codes are in comment1.php.

    but after it's clicked, the comments come out, but the "show comments" is still there. Maybe there's a way i could get rid of it or change it to hide comments.

    I've tried this:

    Code:
    <form action="<?php $_PHP_SELF ?>" method="POST">
    <input name="show" type="submit" value="Show comments" />
    </form>
    
    <?
    
    if ($_SERVER['QUERY_STRING'] == 'show=Show+comments') {
    include ('comment1.php');
    }
    
    ?>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    make a condition so that the button is only shown when the comments are not.

    in the given case it would suffice to put the button (and its form) in the else clause of the condition.

    PS. $_SERVER['QUERY_STRING'] == 'show=Show+comm ents'
    => $_GET['show'] === 'Show comments'

    Comment

    • Toxicous8
      New Member
      • Oct 2015
      • 57

      #3
      Yeah, i didn't actually think about that. I'll try it thanks.

      Comment

      Working...