Translate

Saturday 18 May 2013

Activate&Deactive by On Click


                                      

index.php:


<table  cellpadding="10" cellspacing="0" border="1px" width="30%"><thead>
 <tr> <th class="head0">S.No</th><th class="head1">Main categories</th>
<th class="head0">Activate</th>
 <td>
          <?php 
                        if($cat['verify']=='0')
                        {
                        ?>
        <a href="status.php?verify=<?php echo $cat['fid'];?>" onclick="return confirm('Really you activate the account');">
                        <img src="img/deactivate.png" id="view" width="16" height="16" alt="" /> </a>
                        <?
                        }
                        if($cat['verify']=='1')
                        {
                        ?>
       <a href="status.php?verify=<?php echo $cat['fid'];?>" onclick="return confirm('Really you De-activate the account');"> 
                        <img src="img/activate.png" width="16" id="view" height="16" alt=""  /></a>
                        <?
                        }
                        ?>
                        </td>                             
                        
status.php:


<?php
include("conn.php");
if(isset($_GET['status']))
{
    $status=$_GET['status'];
    
    $select_status=mysql_query("select * from freelisting where fid='$status'");
    
    while($row=mysql_fetch_array($select_status))
    {
        $st=$row['status'];
    
    if($st=='0')
    {
        $status2=1;
    }
    else
    {
        $status2=0;
    }
    $update=mysql_query("update freelisting set status='$status2' where fid='$status' ");
    if($update)
    {
        header("Location:free-listing.php");
    }
    else
    {
        echo mysql_error();
    }
    }
    ?>
     
    <?php
}
?>

No comments:

Post a Comment