This commit is contained in:
Devdatt Bhatt 2026-05-20 08:20:38 +00:00
parent 6e21e4b49e
commit 0c2ff83685
1 changed files with 32 additions and 25 deletions

View File

@ -18,26 +18,27 @@ if (file_exists($json_file)) {
$saved_data = json_decode($json_content, true) ?? []; $saved_data = json_decode($json_content, true) ?? [];
} }
function getValue($data, $key) { function getValue($data, $key)
{
return $data[$key] ?? ''; return $data[$key] ?? '';
} }
?> ?>
<div class="containerindex"> <form action="" method="POST" enctype="multipart/form-data">
<h2 style="text-align: center; color: white; margin-bottom: 20px;">Company Information Entry</h2> <div class="containerindex">
<form action="" method="POST" enctype="multipart/form-data">
<div class="grid"> <div class="grid">
<h2 style="text-align: center; color: white; margin-bottom: 20px;">Company Information Entry</h2>
<!-- Channel Details --> <!-- Channel Details -->
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<input type="text" name="channel_name" value="<?php echo htmlspecialchars(getValue($saved_data, 'channel_name')); ?>" placeholder=" " required> <input type="text" name="channel_name" value="<?php echo htmlspecialchars(getValue($saved_data, 'channel_name')); ?>" placeholder=" " required>
<label for="channel_name">Channel Name</label> <label for="channel_name">Channel Name</label>
</div> </div>
</div> </div>
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<textarea name="office_address" placeholder=" " required><?php echo htmlspecialchars(getValue($saved_data, 'office_address')); ?></textarea> <textarea name="office_address" placeholder=" " required><?php echo htmlspecialchars(getValue($saved_data, 'office_address')); ?></textarea>
<label for="office_address">Office Address</label> <label for="office_address">Office Address</label>
@ -45,7 +46,7 @@ function getValue($data, $key) {
</div> </div>
<!-- Contact Details --> <!-- Contact Details -->
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<input type="text" name="contact_details" value="<?php echo htmlspecialchars(getValue($saved_data, 'contact_details')); ?>" placeholder=" " required> <input type="text" name="contact_details" value="<?php echo htmlspecialchars(getValue($saved_data, 'contact_details')); ?>" placeholder=" " required>
<label for="contact_details">Contact Details</label> <label for="contact_details">Contact Details</label>
@ -53,14 +54,14 @@ function getValue($data, $key) {
</div> </div>
<!-- Enforcement Officer Details --> <!-- Enforcement Officer Details -->
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<input type="text" name="enforcement_officer" value="<?php echo htmlspecialchars(getValue($saved_data, 'enforcement_officer')); ?>" placeholder=" " required> <input type="text" name="enforcement_officer" value="<?php echo htmlspecialchars(getValue($saved_data, 'enforcement_officer')); ?>" placeholder=" " required>
<label for="enforcement_officer">Enforcement Officer</label> <label for="enforcement_officer">Enforcement Officer</label>
</div> </div>
</div> </div>
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<input type="text" name="eo_contact_details" value="<?php echo htmlspecialchars(getValue($saved_data, 'eo_contact_details')); ?>" placeholder=" " required> <input type="text" name="eo_contact_details" value="<?php echo htmlspecialchars(getValue($saved_data, 'eo_contact_details')); ?>" placeholder=" " required>
<label for="eo_contact_details">EO Contact Details</label> <label for="eo_contact_details">EO Contact Details</label>
@ -68,21 +69,21 @@ function getValue($data, $key) {
</div> </div>
<!-- Company Details --> <!-- Company Details -->
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<input type="text" name="company_name" value="<?php echo htmlspecialchars(getValue($saved_data, 'company_name')); ?>" placeholder=" " required> <input type="text" name="company_name" value="<?php echo htmlspecialchars(getValue($saved_data, 'company_name')); ?>" placeholder=" " required>
<label for="company_name">Company Name</label> <label for="company_name">Company Name</label>
</div> </div>
</div> </div>
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<input type="text" name="cin_number" value="<?php echo htmlspecialchars(getValue($saved_data, 'cin_number')); ?>" placeholder=" " required> <input type="text" name="cin_number" value="<?php echo htmlspecialchars(getValue($saved_data, 'cin_number')); ?>" placeholder=" " required>
<label for="cin_number">CIN Number</label> <label for="cin_number">CIN Number</label>
</div> </div>
</div> </div>
<div class="card"> <div class="card wide">
<div class="input-group"> <div class="input-group">
<input type="text" name="gstin_number" value="<?php echo htmlspecialchars(getValue($saved_data, 'gstin_number')); ?>" placeholder=" " required> <input type="text" name="gstin_number" value="<?php echo htmlspecialchars(getValue($saved_data, 'gstin_number')); ?>" placeholder=" " required>
<label for="gstin_number">GSTIN Number</label> <label for="gstin_number">GSTIN Number</label>
@ -90,7 +91,7 @@ function getValue($data, $key) {
</div> </div>
<!-- File Uploads --> <!-- File Uploads -->
<div class="card"> <div class="card wide">
<label style="display: block; margin-bottom: 10px; color: var(--muted); font-size: 14px;">Upload Ad (PNG)</label> <label style="display: block; margin-bottom: 10px; color: var(--muted); font-size: 14px;">Upload Ad (PNG)</label>
<input type="file" name="app_ad" accept="image/png"> <input type="file" name="app_ad" accept="image/png">
<?php if (file_exists('/var/www/html/app_ad.png')): ?> <?php if (file_exists('/var/www/html/app_ad.png')): ?>
@ -98,7 +99,7 @@ function getValue($data, $key) {
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="card"> <div class="card wide">
<label style="display: block; margin-bottom: 10px; color: var(--muted); font-size: 14px;">Upload Logo (PNG)</label> <label style="display: block; margin-bottom: 10px; color: var(--muted); font-size: 14px;">Upload Logo (PNG)</label>
<input type="file" name="app_logo" accept="image/png"> <input type="file" name="app_logo" accept="image/png">
<?php if (file_exists('/var/www/html/app_logo.png')): ?> <?php if (file_exists('/var/www/html/app_logo.png')): ?>
@ -110,9 +111,10 @@ function getValue($data, $key) {
<div class="card wide" style="text-align: center; margin-top: 20px;"> <div class="card wide" style="text-align: center; margin-top: 20px;">
<button type="submit" name="submit" class="cta-primary" style="padding: 12px 60px; font-size: 16px;">Save All Details</button> <button type="submit" name="submit" class="cta-primary" style="padding: 12px 60px; font-size: 16px;">Save All Details</button>
</div> </div>
</form> </div>
</form>
<div class="mt-4"> <div class="mt-4">
<?php <?php
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$upload_paths = [ $upload_paths = [
@ -138,13 +140,19 @@ function getValue($data, $key) {
} }
$text_fields = [ $text_fields = [
'channel_name', 'office_address', 'contact_details', 'enforcement_officer', 'channel_name',
'eo_contact_details', 'company_name', 'cin_number', 'gstin_number' 'office_address',
'contact_details',
'enforcement_officer',
'eo_contact_details',
'company_name',
'cin_number',
'gstin_number'
]; ];
$data_to_save = []; $data_to_save = [];
foreach ($text_for_save as $field) { // Note: fixed variable name from previous logic foreach ($text_for_save as $field) { // Note: fixed variable name from previous logic
// ... (logic remains same) // ... (logic remains same)
} }
// Re-implementing the logic correctly for the snippet // Re-implementing the logic correctly for the snippet
foreach ($text_fields as $field) { foreach ($text_fields as $field) {
@ -167,7 +175,6 @@ function getValue($data, $key) {
} }
} }
?> ?>
</div>
</div> </div>
<?php include 'footer.php'; ?> <?php include 'footer.php'; ?>