Your IP : 10.1.73.149


Current Path : /home/bolconlineco/www/coordinator/
Upload File :
Current File : /home/bolconlineco/www/coordinator/stages.php

<?php
ob_start();
ob_flush();
session_start();
include('includes/header.php');
include('functions.php');
require '../emails/PHPMailerAutoload.php';

if(!isset($_SESSION['coordinator']) || $_SESSION['coordinatorrole'] != 2) {
    header("location:../index.php");
    exit();
}
if(isset($_POST['stage_submit'])){
    $title = $_POST['title'];
    $sql = "INSERT INTO stages (title) VALUES ('$title')";
    $result = mysql_query($sql);
    if(!$result){
        die(mysql_error());
    }
}



if(isset($_POST['stage_update'])){
    $id=$_POST['id'];
    $title = $_POST['title'];
    $sql = "UPDATE stages SET title='$title' WHERE id='$id'";
    mysql_query($sql);
    header('location:stages.php');
    exit();
}
?>

<style>

</style>
<h3 class="page-title">Stages</h3>
<ul class="page-breadcrumb breadcrumb">
    <li><i class="fa fa-home"></i> <a href="dashbord.php"> Home </a> <i class="fa fa-angle-right"></i> </li>
    <li class="active">Stages</li>
</ul>
<div class="row clearfix">

<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet box blue">
<div class="portlet-title clearfix">
    <div class="caption"> <i class="fa fa-globe"></i>Stages</div>
</div>

<div class="portlet-body clearfix">

<form method="post" action="">
    <?php if(isset($_GET['id'])){
        $id = $_GET['id'];
        $sql = mysql_query("select * from stages where id='$id'");
        $row = mysql_fetch_array($sql);
        ?>

        <div class="col-xs-6 col-md-offset-3">
            <input type="text" placeholder="Enter Title" class="form-control" name="title" value="<?php echo $row['title']; ?>" required/>
            <input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
        </div>

        <div class="col-xs-2">
            <input type="submit" value="Update" name="stage_update" class="btn btn-success">
        </div>

    <?php } else { ?>

        <div class="col-xs-6 col-md-offset-3">
            <input type="text" placeholder="Enter Title" class="form-control" name="title" required/>
        </div>
        <div class="col-xs-2">
            <input type="submit" value="Add" name="stage_submit" class="btn btn-success">
        </div>

    <?php } ?>

</form>

<table class="tablestyle table_style1 table table-striped table-bordered table-hover" id="sample_2">

    <thead>
        <tr>
            <th>Sr</th>
            <th>Title</th>
            <th></th>
        </tr>
    </thead>

    <tbody class="inbox_data_found">
        <?php
            $sql = mysql_query('SELECT * FROM stages ORDER BY id ASC');
            while($row = mysql_fetch_array($sql)){?>
        <tr>
            <td><?php echo $row['id']; ?></td>
            <td><?php echo $row['title']; ?></td>
            <td><a href="stages.php?id=<?php echo $row['id']; ?>">Edit</a></td>
        </tr>
    <?php } ?>
    </tbody>

</table>


</div>
</div>
</div>
</div>
</div>
</div>
</div>


 <?php include('../includes/footer.php');?>