irwan Dwiyanto
irwan Dwiyanto

Reputation: 321

how display and hide the button with the value from database

how to create a button to hide the value of the database. for example :

<a href="#alatrusak" class="btn pull-right btn-danger btn3d" id="alatrusakshow" value="<?php echo $detail['status'] ?> ">

value status = 1 and 2

if button1 value status = 1 results show

and

if button1 value status = 2 results hidden

Upvotes: 2

Views: 1424

Answers (3)

Parixit
Parixit

Reputation: 3855

That's it!! For more detail on conditional statement check this

<?php if($detail['status']=='1') { ?>
    <!-- Show anything you want to display when status = 1 -->
    <a href="#alatrusak" class="btn pull-right btn-danger btn3d" id="alatrusakshow" value="<?php echo $detail['status'] ?>">
<?php } ?>

Upvotes: 0

redreddington
redreddington

Reputation: 408

Underneath your button you would just check the value of $detail['status']

<?php

    if ($detail['status'] == 1) {
        // echo results
    } else {
        // echo no result message
    }
?>

Upvotes: 1

Vigneswaran S
Vigneswaran S

Reputation: 2094

get the value from db $status=$detail['status'] ; and check if present and show it . very simple :)

 <?php
$status=$detail['status'] ;
if($status==1){
?>
<a href="#alatrusak" class="btn pull-right btn-danger btn3d" id="alatrusakshow" value="<?php echo $status;?> ">
<?php
}
elseif($status==2){
?>
<a href="#alatrusak" class="btn pull-right btn-danger btn3d" id="alatrusakshow" value="<?php echo $status;?> ">
<?php
}

Upvotes: 0

Related Questions