prepare( 'SELECT * FROM `soil_records` WHERE `id` = ? AND `rand` = ? LIMIT 1' ); $stmt->execute([$record_id, $rand_id]); $row = $stmt->fetch(); } catch (PDOException $e) { error_log('soil-analysis-pdf.php DB error: ' . $e->getMessage()); http_response_code(500); die('Database error.'); } if (!$row) { http_response_code(404); die('Record not found.'); } // All values escaped for HTML output $h = fn($v) => htmlspecialchars((string)($v ?? ''), ENT_QUOTES, 'UTF-8'); $client = $h($row['client_name']); $address = $h($row['site_address']); $state = $h($row['state_postcode']); $email = $h($row['email']); $labNo = $h($row['lab_no']); $sampleDate = $h($row['date_sampled']); $sample = $h($row['site_id']); $crop = $h($row['sample_id']); $today = date('jS F Y'); // Navigation URLs (replacing modX [[~41~]], [[~66~]], [[~37~]] resource links) $params = http_build_query(['rand' => $rand_id, 'cid' => $client_id, 'rid' => $record_id, 'stid' => $croptype]); $analysisUrl = '/dashboard/crop-analysis/soil-test-data/soil-analysis.php?' . $params; $reportUrl = '/dashboard/crop-analysis/soil-test-data/soil-report.php?' . $params; ?> Soil Analysis PDF | Crop Monitor
Crop Monitor
DATE: SAMPLE ID:
CLIENT: DATE SAMPLED:
ADDRESS: LAB NUMBER:
CROP: