mardi 17 avril 2018

how should i include a else statment here

i want to include a else statement after the completion of the block after the second if for category equal to helathcare ....now i want another else for finance but i am not getting where excatly to place that else i have a confusion on where to keep the else for finance and 2 more categories now whenever i try to place the one else at the last goes unrecable to its if statement i donno its very confusing as to where to place 2 more else if statments for 2 more categories

<?php
global $row2;
if(isset($_POST['category']))
{
            if($_POST['category']== 'Healthcare')
            {

            $query = "select *from event where category = 'Healthcare';";
            $result=mysqli_query($conn,$query)or die(mysqli_error($conn));
             while($row2= mysqli_fetch_array($result)) 
             {
            ?>
    <div class="events events-full event-list">
      <div class="container">
        <div class="row">
          <div class="col-md-9 col-sm-8"> 
            <!--Blog Post Start-->
            <div class="blog-post">
              <div class="post-thumb">
                <div class="link-wrap"> <a href="#"><i class="fa fa-search"></i></a> <a href="#"><i class="fa fa-link"></i></a> </div>
                <img src="images/gallery/<?php echo $row2['event_image']?>" alt='user'></div>
              <div class="event-text">
                <div class="event-counter"></div>
                <h4> <a href="#"><?php echo($row2['title']); ?></a> </h4>
                <p><?php echo($row2['descrption']); ?></p>
                <p><span class="glyphicon glyphicon-map-marker"><?php echo($row2['location']); ?></span></p>
                <p><span class="glyphicon glyphicon-grain"><?php echo($row2['organizer']); ?></span></p>
                <a class="nd" href="">
                  <form action="eventdetail.php" method="post">

<input type='hidden' value="<?php echo $row2['id']; ?>" name='id'/>


<button type="submit" class="btn btn-primary" name="detail" value=”detail”>Event Detail</button>
            </div>
                </a> </div>
            </div>
          </form>

            <!--Blog Post End-->
  <?php } 








}




}

        else
        {


              global $row2;
            $query = "select *from event;"  ;
            $result=mysqli_query($conn,$query)or die(mysqli_error($conn));
             while($row2= mysqli_fetch_array($result)) 
             {
            ?>
    <div class="events events-full event-list">
      <div class="container">
        <div class="row">
          <div class="col-md-9 col-sm-8"> 
            <!--Blog Post Start-->
            <div class="blog-post">
              <div class="post-thumb">
                <div class="link-wrap"> <a href="#"><i class="fa fa-search"></i></a> <a href="#"><i class="fa fa-link"></i></a> </div>
                <img src="images/gallery/<?php echo $row2['event_image']?>" alt='user'></div>
              <div class="event-text">
                <div class="event-counter"></div>
                <h4> <a href="#"><?php echo($row2['title']); ?></a> </h4>
                <p><?php echo($row2['descrption']); ?></p>
                <p><span class="glyphicon glyphicon-map-marker"><?php echo($row2['location']); ?></span></p>
                <p><span class="glyphicon glyphicon-grain"><?php echo($row2['organizer']); ?></span></p>
                <a class="nd" href="">
                  <form action="eventdetail.php" method="post">

<input type='hidden' value="<?php echo $row2['id']; ?>" name='id'/>


<button type="submit" class="btn btn-primary" name="detail" value=”detail”>Event Detail</button>
            </div>
                </a> </div>
            </div>
          </form>

            <!--Blog Post End-->
            <?php  } } ?>

       ?>

Aucun commentaire:

Enregistrer un commentaire