我想通过管理面板下拉菜单启用或禁用“博客帖子”

I want to enable or disable post by clicking drop down values. How can i do that?

<script>
  function disable(post)
  {
      if(post=="0")
           document.getElementById("status").disabled=true;
      else
          document.getElementById("status").disabled=false;
  }
</script>

<select name="status" id=<?= $row["id_post"] ?>  onChange="disable(this.value)">
  <option value="0">Status</option>
  <option name="enable"  id="enable"  value="1">Enable</option>
  <option name="disable" id="disable" value="0">Disable</option>
</select>

i have a field in my database table name "r_post" column name "status int(1)"

No need to use JavaScript for Enable and Disable as per your code.

<select name="status">
  <option>Status</option>
  <option value="1" <?php ($row["status"]==1)?'selected':'' ?>>Enable</option>
  <option value="0" <?php ($row["status"]==0)?'selected':'' ?>>Disable</option>
</select>

Edit Your Code Firstly you need to create a php action page, if you want to create this page, then you can write down the code into you same php file. then on select for select box you need to submit the form. Then action will be goes on same page and your update query will update your blog record. Your need to add your table id the in hidden input type so the query will get the exact address.

<html>
    <head>
    <?php
      if(isset($_POST['status']))
      {
        $sql=mysql_query("update blog set status='".$_POST['Status']."' where id='".$_POST['id']."'");
        echo ("blog updated successfully");
      }
    ?>
    <title>Your Page name</title>
    </head>
    <body>

<form name="myform" action="" method="post">
<input type="hidden" name="id" value="<?php echo $row['id'];?>">
<select name="status" id="status1" onchange="this.form.submit()">
  <option value="0">Status</option>
  <option name="enable"  id="1enable"  value="1">Enable</option>
  <option name="disable" id="1disable" value="0">Disable</option>
</select>
</form>
</body>