Example #1
0
<?php

ob_start();
include "includes/header.php";
//session_start();
if ($_SESSION['login'] != 'Admin') {
    header('location:admin_login.php');
}
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
    deletedata($_GET['id']);
    header('Location:view_product.php');
}
?>
<style>
@media only screen and (max-width: 800px) {
	#unseen table td:nth-child(2), 
	#unseen table th:nth-child(2) {display: none;}
}
 
@media only screen and (max-width: 640px) {
	#unseen table td:nth-child(4),
	#unseen table th:nth-child(4),
	#unseen table td:nth-child(7),
	#unseen table th:nth-child(7),
	#unseen table td:nth-child(8),
	#unseen table th:nth-child(8){display: none;}
}

</style>
  
    <div class="container">

<?php 
$conn;
if (isset($_POST["operation"])) {
    if ($_POST["operation"] == 'edit') {
        editdata();
    }
    if ($_POST["operation"] == 'delete') {
        deletedata();
    }
} else {
    fetchdata();
}
function editdata()
{
    if (connectdb()) {
        $conn = connectdb();
    }
    $editquery = "UPDATE formdata SET name='{$_POST['name']}',sex='{$_POST['sex']}',email='{$_POST['email']}',country='{$_POST['country']}',\n\t\t\t\t\t\t\t\t\t\tstate='{$_POST['state']}',address='{$_POST['address']}',mobileno='{$_POST['mobileno']}',interest='{$_POST['interests']}',favorites='{$_POST['favorites']}' where email='{$_POST['email']}'";
    if (mysqli_query($conn, $editquery)) {
        echo '{"message":"Successfully updated"}';
    } else {
        echo "Error";
    }
    mysqli_close($conn);
}
function connectdb()
{
    $GLOBALS['conn'] = new mysqli("localhost", "root", "", "subscription");
    // Check connection
Example #3
0
     cancelform($option);
     break;
 case "cancelfield":
     cancelfield($option);
     break;
 case 'listdata':
     listdata($option, $cid);
     break;
 case 'exportdata':
     exportdata($option, $rcid);
     break;
 case 'exportalldata':
     exportdata($option, -1);
     break;
 case 'deldata':
     deletedata($option, $rcid);
     break;
 case 'sample':
     addSampleData($option);
     break;
 case 'saveorder':
     saveOrder($cid);
     break;
 case 'saveRegistration':
     saveRegistration($option);
     break;
 case 'backup':
     backup();
     break;
 case 'restore':
     restore($option);