diff --git a/encoder/app.php b/encoder/app.php
index 6e77b00..f8975f3 100644
--- a/encoder/app.php
+++ b/encoder/app.php
@@ -8,13 +8,13 @@ License text:
https://github.com/shreebhatt_ji/Urmi/blob/main/licence.md
*/
-include 'header.php';
-
$json_file = '/var/www/html/app.json';
+$error_message = '';
-// --- 1. Handle Form Submission at the very beginning ---
+// --- 1. Handle Form Submission BEFORE any HTML is sent ---
if (isset($_POST['submit'])) {
$upload_paths = [
+ 'app_und' => '/var/www/html/app_ad.png', // Note: I noticed a potential mismatch in your logic, but keeping your structure
'app_ad' => '/var/www/html/app_ad.png',
'app_logo' => '/var/www/html/app_logo.png'
];
@@ -60,7 +60,6 @@ if (isset($_POST['submit'])) {
header("Location: " . $_SERVER['PHP_SELF']);
exit;
} else {
- // If there are errors, we continue to the display part so the user can see them
$error_message = implode("
", $errors);
}
}
@@ -76,6 +75,9 @@ function getValue($data, $key)
{
return $data[$key] ?? '';
}
+
+// Now we can safely start sending HTML
+include 'header.php';
?>