title: make bootstrap alert disappear automatically
body: <p>i have a form whch sends data to the databse, after data is sent successfully i want to show success msg, but i dont want it to stay rather to disappear after a short while.</p>
  
  <pre><code>$nameErr=$drug_idErr=$priceErr=$quantityErr=$dateErr=$dateInvalid="";
  
  $drug_id=$name=$price=$quantity=$date="";
  
  if(isset($_POST['submit'])){
  
  $drug_id=mysql_real_escape_string(addslashes($_POST['drug_id']));
  $name=mysql_real_escape_string(addslashes($_POST['name']));
  $price=mysql_real_escape_string(addslashes($_POST['price']));
  $quantity=mysql_real_escape_string(addslashes($_POST['quantity']));
  $date=mysql_real_escape_string(addslashes($_POST['date']));
  
  
      if(empty($drug_id)){
          $drug_idErr="Required";
  
          }
      elseif(empty($name)){
          $nameErr="Required";
  
          }
      elseif(empty($price)){
          $priceErr="Required";
          }
  
      elseif(empty($quantity)){
          $quantityErr="Required";
          }
  
      elseif(empty($date)){
          $dateErr="Required";
          }
      elseif(!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $date)){
  
          $dateInvalid="Invalid date format";
          }
      else{
  
          //send data to database here
          $_SESSION['success']="Drug added successfully";
          $drug_id=$name=$price=$quantity=$date="";
  
  
          }
  
  }
  </code></pre>
  
  <p>the following is my form</p>
  
  <pre><code>&lt;div class="well"&gt;
        &lt;form id="register-form" class="form-horizontal" method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
          &lt;legend&gt;Add new drug&lt;/legend&gt;
          &lt;?php  if(!empty($_SESSION['success'])){ 
           echo '&lt;div class="alert alert-success"&gt;'.$_SESSION['success'].'&lt;/div&gt;'; unset($_SESSION['success']);} ?&gt;
  
  
          &lt;div class="control-group"&gt;
              &lt;label class="control-label"&gt;ID&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;div class="input-prepend"&gt;
                  &lt;span class="add-on"&gt;&lt;i class="icon-ban-circle"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;input type="text" class="input-xlarge" id="drug_id" name="drug_id" placeholder="Drug ID"
                       value="&lt;?php echo htmlspecialchars($drug_id); ?&gt;"&gt;
                  &lt;/div&gt;
                   &lt;span class="error"&gt;&lt;?php echo $drug_idErr;?&gt;&lt;/span&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
          &lt;div class="control-group "&gt;
              &lt;label class="control-label"&gt;Name&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;div class="input-prepend"&gt;
                  &lt;span class="add-on"&gt;&lt;i class="icon-pills"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;input type="text" class="input-xlarge" id="name" name="name" placeholder="Drug Name"
                      value="&lt;?php echo htmlspecialchars($name)?&gt;"&gt;  
                 &lt;/div&gt;
                 &lt;span class="error"&gt;&lt;?php echo $nameErr;?&gt;&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="control-group"&gt;
              &lt;label class="control-label"&gt;Price&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;div class="input-prepend"&gt;
                  &lt;span class="add-on"&gt;&lt;i class="icon-dollars"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;input type="text" class="input-small" id="price" name="price" placeholder="Drug Price"
                      value="&lt;?php echo htmlspecialchars($price); ?&gt;"&gt;
                  &lt;/div&gt;
                   &lt;span class="error"&gt;&lt;?php echo $priceErr; ?&gt;&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
          &lt;div class="control-group"&gt;
              &lt;label class="control-label"&gt;Quantity&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;div class="input-prepend"&gt;
                  &lt;span class="add-on"&gt;&lt;i class="icon-ban-circle"&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;input type="text" id="quantity" class="input-mini" name="quantity" placeholder="Quantity"
                      value="&lt;?php echo htmlspecialchars($quantity);?&gt;"&gt;
                  &lt;/div&gt;
                   &lt;span class="error"&gt;&lt;?php echo $quantityErr;?&gt;&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
          &lt;div class="control-group"&gt;
              &lt;label class="control-label"&gt;Expire Date&lt;/label&gt;
              &lt;div class="controls"&gt;
              &lt;div class="input-prepend"&gt;
              &lt;span class="add-on"&gt;&lt;i class="icon-time"&gt;&lt;/i&gt;&lt;/span&gt;
  
             &lt;td&gt;&lt;input type="text" name="date"  id="date"   class="span2" placeholder="Expire date" 
             value="&lt;?php echo htmlspecialchars($date); ?&gt;"/&gt;
              &lt;/div&gt;
                &lt;span class="error"&gt;&lt;?php  echo  $dateErr.$dateInvalid; ?&gt;&lt;/span&gt;
       &lt;/div&gt;
         &lt;/div&gt;
  
  
          &lt;div class="control-group"&gt;
          &lt;label class="control-label"&gt;&lt;/label&gt;
            &lt;div class="controls"&gt;
  
             &lt;button type="submit" class="btn btn-success" name="submit" &gt;Add&lt;/button&gt;
  
            &lt;/div&gt;
  
      &lt;/div&gt;
  
        &lt;/form&gt;
  
     &lt;/div&gt;
  </code></pre>
  
  <p>now i can just show the alert but i don knw how to make it disappear </p>