<?php
include("../includes/db_connection.php");

$id=$_POST['id'];
$name=$_POST['name'];
$status=$_POST['status'];

if($id){

$stmt=$conn->prepare("UPDATE accreditations SET name=?,status=? WHERE id=?");
$stmt->bind_param("ssi",$name,$status,$id);

}else{

$stmt=$conn->prepare("INSERT INTO accreditations(name,status) VALUES(?,?)");
$stmt->bind_param("ss",$name,$status);

}

$stmt->execute();

header("Location: accreditations.php");
?>