Files
x-editable-bs5/demo/demo.php
Micha 9524a8acf8 Reorganize project structure and finalize Bootstrap 5 cleanup
- Create demo folder and move test files with proper naming
- Rename test.html/js/php to demo/index.html/demo.js/demo.php
- Update Gruntfile.js to Bootstrap 5 only configuration
- Clean up package.json dependencies (remove unused webpack/popper.js)
- Remove non-Bootstrap 5 dist directories
- Update webpack config to use demo files
- Fix demo paths and ensure fully functional demo
2025-07-27 14:08:17 +02:00

31 lines
986 B
PHP

<?php
header("Content-Type: application/json");
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Sample data for select dropdown
echo json_encode([
["value" => 1, "text" => "Yes"],
["value" => 0, "text" => "No"]
]);
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Simulate saving the data and returning success response
$input = json_decode(file_get_contents("php://input"), true);
// If JSON is empty, try to read form-encoded data
if (!$input) {
$input = $_POST;
}
if (!isset($input['name']) || !isset($input['value'])) {
http_response_code(400);
echo json_encode(["error" => "Invalid request"]);
exit;
}
// Normally, you would store this in a database, but for testing, just return success
echo json_encode(["success" => true, "newValue" => $input['value']]);
} else {
http_response_code(405); // Method Not Allowed
echo json_encode(["error" => "Method Not Allowed"]);
}