<?php
include_once("Globals.php");
global $model;
I want to capture the $order_id value from the $_GET['claim_order'] for future re-use.
if(isset($_GET['claim_order'])){
$order_id = $_GET['claim_order'];
}
for example the value saved in the $order_id variable is not available for repeat use on the current page.
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Caregiver Claims Order</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<link rel="stylesheet" href="../../plugins/fontawesome-free/css/all.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="../../dist/css/adminlte.min.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- Sidebar -->
<div class="sidebar">
<!-- Sidebar user (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="info">
<a href="#" class="d-block">SESSION: Caregiver</a>
</div>
</div>
<!-- Sidebar Menu -->
<nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
</ul>
</nav>
<!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header" style="padding: 0px 0px 0px 0px" >
<div class="container-fluid " style="padding: 0px 0px 0px 0px" >
<div class ="row">
<div class="col">
<h1>Order#<?php
global $order_id;
echo (int)$order_id;
?></h1>
</div>
<div class ="col-auto">
<a href ="CaregiverCODetailView.php?button_claim=$care_giver_id">
<input type="submit" name="button_claim" class="btn btn-primary"></input>
</a>
<?php
if(isset($_GET["button_claim"])){
for example in the next 3 lines I try to use it but it returns the wrong value of 0 instead the correct value corresponding to the "button_claim".
I want to be able to refer to the value even if I refresh the .php page.
All I want to do is use that $order_id value in a SQL query. It basically indicates the ID# of the order in question.
$care_giver_id = $model->getCurrentUserId();
global $order_id;
$sql = "UPDATE `order` SET `care_giver_id` = '$care_giver_id' WHERE `order_id` = '$order_id'";
if(!mysqli_query($conn, $sql)){
header("Location: fail.php");
}else{
header("Location: CaregiverCODetailView.php");
}
}
?>
</div>
</div>
<div class="row" style="min-height:71vh" style="min-width:100vw">
<div class= "col" style="min-height:71vh" style="min-width:100vw">
<table id="example4" class="table table-borderless table-hover">
<?php
global $conn;
global $order_id;
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT";
$sql .= " `medication`.`name` as `name`,";
$sql .= " `medication`.`physical_form` as `form`,";
$sql .= " `medication`.`units` as `units`,";
$sql .= " `break_down`.`administer_time` as `time`,";
$sql .= " `break_down`.`quantity` as `quantity`";
$sql .= " FROM `break_down`";
$sql .= " JOIN `medication` on (`medication`.`medication_id` = `break_down`.`medication_id`)";
$sql .= " WHERE `break_down`.`order_id` = '$order_id'";
$result = $conn->query($sql);
echo "<id='example2'>";
echo "<tbody>";
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['quantity'] . $row['units']. "</td>";
echo "<td>" . $row['form'] . "</td>";
echo "<td>" . $row['time'] . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
} else {
echo "</tbody>";
echo "</table>";
echo "<h4>ORDERS DATABASE EMPTY</h4>";
}
?>
</div>
</div>
<div class="row" style="min-height:15vh" style="min-width:100vw">
<div class= "col" style="background-color:orange" style="min-height:15vh" style="min-width:100vw" >
<?php
global $conn;
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = " select " ;
$sql .= " `patient`.`first` as `first`,";
$sql .= " `patient`.`last` as `last`,";
$sql .= " `order`.`order_id` as `order_id`,";
$sql .= " `order`.`date` as `datefield`";
$sql .= " from `patient`";
$sql .= " join `order` on (`order`.`patient_id` = `patient`.`patient_id`)";
$sql .= " where `order`.`order_id` = '$order_id'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<div class='row '>";
echo "<div class ='col '>";
echo "<h3>Patient</h3>";
echo "<h5>" . $row['first'] . " " . $row['last'] . "</h5>";
echo "</div>";
echo "<div class = 'col-auto '>";
echo "<h3>Date Created</h3>";
echo "<h5>" . $row['datefield'] . "</h5>";
echo "</div>";
echo "</div>";
}
}
?>
</div>
</div>
</div>
<!-- /.container-fluid -->
</section>
</div>
</div>
<!-- ./wrapper -->