الشحن إلى us


moto sands for me

moto sands for me

1,450.00 omr
الموقع: nzwa, om
التاريخ: 2024-08-19 21:22
المشاهدات: 128
<?php include_once "settings.php"; // Ensure this file sets up $connessione (database connection) //include 'ar.php'; if(isset($_GET["accessCat"])) $_SESSION["ad"]=$_GET["accessCat"]; //for the cntrol to dsply ads && (HIDE) not to display the cars brands logos $bId = htmlspecialchars($_GET['bId'] ?? $_GET['bId']); // Check if the 'accessCat' GET parameter is set $accessCat = isset($_GET['accessCat']) ? $_GET['accessCat'] : ''; // Define available categories and their fields $categories = $_SESSION['translations']['category']; // Process form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { $category = $connessione->real_escape_string($_POST['accessCat'] ?? $_GET['accessCat']); $title = $connessione->real_escape_string($_POST['title'] ?? ''); $berid = $connessione->real_escape_string($_POST['berid'] ?? ''); $hetef = $connessione->real_escape_string($_POST['hetef'] ?? ''); $country = $connessione->real_escape_string($_POST['country'] ?? ''); $location_city = $connessione->real_escape_string($_POST['location_city'] ?? ''); $price = $connessione->real_escape_string($_POST['price'] ?? ''); $el3omla = $connessione->real_escape_string($_POST['el3omla'] ?? ''); $description = $connessione->real_escape_string($_POST['description'] ?? ''); $quantity = $connessione->real_escape_string($_POST['quantity'] ?? ''); $yearModel = $connessione->real_escape_string($_POST['yearModel'] ?? $_GET['year']); $views = intval($_POST['views'] ?? 0); //$attributes = $connessione->real_escape_string($_POST['attributes'] ?? ''); // Collect prod attributes data with default values $attributes__ = [ 'brand' => $_GET['brand'] ?? '', 'year' => $yearModel ?? '', 'regional_specifications' => $_POST['property3'] ?? '', 'odometer' => $_POST['property4'] ?? '', 'cylinders' => $_POST['property5'] ?? '', 'transmission' => $_POST['property6'] ?? '', 'keys' => $_POST['property7'] ?? '', 'full_options' => $_POST['property8'] ?? '', 'fuel' => $_POST['property9'] ?? '', 'wheel_drive' => $_POST['property10'] ?? '', 'exterior_color' => $_POST['property11'] ?? '', 'interior_color' => $_POST['property12'] ?? '', 'maintenance_report' => $_POST['property13'] ?? '', 'car_status' => $_POST['property17'] ?? '' ]; // Initialize an array to hold form data $formData = []; $formHtml = isset($_POST['form_html']) ? $_POST['form_html'] : ''; // Check if 'form_html' is set and is an array if (isset($_POST['form_html']) && is_array($_POST['form_html'])) { foreach ($_POST['form_html'] as $key => $value) { // Sanitize each value $formData[$key] = htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); } } else { echo 'Error: form_html is not set or not an array.'; } // Output the sanitized form data foreach ($formData as $key => $value) { echo htmlspecialchars($key) . ': ' . htmlspecialchars($value) . '<br>'; } // Build the JSON object for the attributes field $attributes = [ 'form_html' => $formHtml, 'data' => $formData ]; // Convert the attributes array to a JSON string $attributesJson = json_encode($attributes); // Sanitize the JSON string for safe insertion $attributes = $connessione->real_escape_string($attributesJson); //$attributes = $connessione->real_escape_string(json_encode($attributes)); $delivery_available = isset($_POST['delivery_available']) ? 1 : 0; $negotiable_price = isset($_POST['negotiable_price']) ? 1 : 0; $status = $connessione->real_escape_string($_POST['status'] ?? ''); $collector = $connessione->real_escape_string($_POST['collector'] ?? ''); // Handle file uploads $images = []; if (isset($_FILES['images']) && !empty($_FILES['images']['name'][0])) { $uploadDir = 'uploads/'; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0755, true); } foreach ($_FILES['images']['tmp_name'] as $key => $tmp_name) { $fileName = basename($_FILES['images']['name'][$key]); $uploadFile = $uploadDir . $fileName; if (move_uploaded_file($tmp_name, $uploadFile)) { $images[] = $uploadFile; } } } $imagesList = implode(',', $images); try { $sql = mysqli_query($connessione, "INSERT INTO `bathae3i` ( `idBathae3i`, `images`, `category`, `title`, `berid`, `hetef`, `country`, `location_city`, `price`, `el3omla`, `description`, `quantity`, `chronoBathae3`, `views`, `attributes`, `delivery_available`, `negotiable_price`, `status`, `collector` ) VALUES ( NULL, '$imagesList', '$category', '$title', '$berid', '$hetef', '$country', '$location_city', '$price', '$el3omla', '$description', '$quantity', '".time()."', $views, '$attributes', $delivery_available, $negotiable_price, '$status', '$collector' )"); if (!$sql) { die('Error: ' . htmlspecialchars($connessione->error)); } } catch(Exception $e) { echo "Exception: " . $e->getMessage(); } } // Retrieve records from the database $sql = "SELECT * FROM `bathae3i` WHERE idBathae3i = '" . $bId . "'"; $result = $connessione->query($sql); ?> <!DOCTYPE html> <html <?php if(!isset($_SESSION['lang']) || $_SESSION['lang']=="ar") echo"lang=ar dir=rtl"; else echo"lang=en dir=ltr"; ?>> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Bathae3i Management</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css__"> <style> body { <?php if(!isset($_SESSION['lang']) || $_SESSION['lang']=="ar") echo"lang=ar dir=rtl"; else echo"lang=en dir=ltr"; ?> background-color: #f8f9fa; font-family: Arial, sans-serif; } .container { max-width: 1200px; margin: 20px auto; padding: 20px; background-color: #ffffff; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); border-radius: 8px; } .form-control { display: block; width: 100%; height: calc(1.5em + .75rem + 2px); padding: .375rem .75rem; margin-top: 3px; font-size: 1rem; font-weight: 400; line-height: 1.5; color: #495057; background-color: #fff; background-clip: padding-box; border: 1px solid #ced4da; border-radius: .25rem; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; } .btn { display: inline-block; font-weight: 400; color: #212529; text-align: center; vertical-align: middle; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-color: transparent; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out; } .btn-primary { color: #fff; background-color: #007bff; border-color: #007bff; } h1 { margin-bottom: 20px; } form { margin-bottom: 30px; } .form-group { margin-bottom: 15px; } .form-control, .form-check-input { border-radius: 4px; } .custom-file-input { display: none; } .custom-file-upload { border: 2px solid #007bff; border-radius: 8px; display: inline-block; padding: 12px 24px; cursor: pointer; background: linear-gradient(135deg, #007bff 0%, #00d2ff 100%); color: #ffffff; text-align: center; font-weight: bold; font-size: 16px; transition: all 0.3s ease; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); position: relative; } .custom-file-upload:hover { background: linear-gradient(135deg, #00d2ff 0%, #007bff 100%); color: #f0f0f0; transform: scale(1.05); } .custom-file-upload:before { content: '???? '; position: absolute; <?php if(!isset($_SESSION['lang']) || $_SESSION['lang']=="ar") echo"right: 0px;"; else echo"left: 0px;"; ?> top: 40%; transform: translateY(-50%); font-size: 18px; } .custom-file-input { display: none; } .image-preview { display: flex; flex-wrap: wrap; margin-top: 10px; } .image-preview img { max-width: 100px; margin-right: 5px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .image-preview { display: flex; flex-wrap: wrap; margin-top: 10px; border: 2px dashed #007bff; border-radius: 8px; padding: 10px; background-color: #f8f9fa; min-height: 120px; position: relative; overflow: auto; } .image-preview .placeholder { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #007bff; font-size: 18px; font-weight: bold; text-align: center; pointer-events: none; } .image-preview img { max-width: 100px; margin: 5px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } table { width: 100%; border-collapse: collapse; } table th, table td { border: 1px solid #dee2e6; padding: 12px; text-align: left; } table th { background-color: #007bff; color: #ffffff; } table td { background-color: #ffffff; } .attributes-list { white-space: pre-wrap; /* Preserve whitespace for line breaks */ } .details-list { list-style-type: none; padding: 0; margin: 0; } .details-list li:nth-child(even) { background-color: #f9f9f9; } .details-list li { padding: 10px; border-bottom: 1px solid #eee; } .details-container { background-color: #fff; border: 1px solid #ddd; padding: 20px; margin-bottom: 20px; font-family: Arial, sans-serif; width: 100%; margin: 0 auto; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } ._vkey{ <?php if(!isset($_SESSION['lang']) || $_SESSION['lang']=="ar") echo"margin-left: 40px;"; else echo"margin-right: 40px;"; ?> } </style> </head> <body> <div class="container"> <h1>Insert New Record</h1> <form method="post" action="?accessCat=<?php echo $_GET['accessCat']; ?>&brand=<?php echo $_GET['brand']; ?>&year=<?php echo $_GET['year']; ?>" enctype="multipart/form-data"> <!--div class="form-group"> <label for="category">Category:</label> <input type="text" id="category" name="accessCat" class="form-control" required> </div --> <div class="form-group"> <label for="images" class="custom-file-upload"> <span><?php echo $_SESSION["imageUpload"]; ?></span> </label> <input type="file" id="images" name="images[]" class="custom-file-input" accept="image/*" multiple> <div class="image-preview" id="image-preview"> <div class="placeholder"><?php echo $_SESSION["imagesselected"]; ?></div> </div> </div> <div class="form-group"> <label for="title">Title:</label> <input type="text" id="title" name="title" class="form-control" required> </div> <?php if($_GET["accessCat"]=="cars")include_once"_carsSpecificities.php"; ?> <?php //include_once"_vpcategoriesForms.php"; // Function to generate form fields function generateFormFields($fields) { $formHtml = ''; foreach ($fields as $field => $label) { if (is_array($label)) { // Check if the field has subvalues $formHtml .= '<label for="' . htmlspecialchars($field) . '">' . htmlspecialchars($label['type']) . ':</label>'; $formHtml .= '<select id="' . htmlspecialchars($field) . '" name="' . htmlspecialchars($field) . '" class="form-control">'; foreach ($label as $subValue => $subLabel) { if ($subValue !== 'type') { // Skip the 'type' key $formHtml .= '<option value="' . htmlspecialchars($subValue) . '">' . htmlspecialchars($subLabel) . '</option>'; } } $formHtml .= '</select><br><br>'; } else { $formHtml .= '<label for="' . htmlspecialchars($field) . '">' . htmlspecialchars($label) . ':</label>'; $formHtml .= '<input type="text" id="' . htmlspecialchars($field) . '" class="form-control" name="' . htmlspecialchars($field) . '" placeholder="' . htmlspecialchars($label) . '"><br><br>'; } } return $formHtml; } ?> <?php if ($accessCat): ?> <?php // Split the selected category into category and subcategory list($category, $subcategory) = explode('/', $accessCat); // Check if the selected category and subcategory exist if (isset($categories[$category][$subcategory])) { $fields = $categories[$category][$subcategory]; ?> <h2><?= htmlspecialchars($subcategory) ?></h2> <div method="post" class="_carContainer image-preview"> <?= generateFormFields($fields) ?> <!-- input type="submit" value="إرسال" --> </div> <?php } else { echo '<p class="error-message">الفئة أو التصنيف المحدد غير موجود.</p>'; } ?> <?php endif; ?> <div class="form-group"> <label for="berid">Berid:</label> <input type="text" id="berid" name="berid" class="form-control" required> </div> <div class="form-group"> <label for="hetef">Hetef:</label> <input type="text" id="hetef" name="hetef" class="form-control" required> </div> <div class="form-group"> <label for="country">Country:</label> <input type="text" id="country" name="country" class="form-control" required> </div> <div class="form-group"> <label for="location_city">City:</label> <input type="text" id="location_city" name="location_city" class="form-control" required> </div> <div class="form-group"> <label for="price">Price:</label> <input type="text" id="price" name="price" class="form-control" required> </div> <div class="form-group"> <label for="el3omla">Currency:</label> <input type="text" id="el3omla" name="el3omla" class="form-control" required> </div> <div class="form-group"> <label for="description">Description:</label> <textarea id="description" name="description" class="form-control" rows="4" required></textarea> </div> <div class="form-group"> <label for="quantity">Quantity:</label> <input type="text" id="quantity" name="quantity" class="form-control" required> </div> <div class="form-group"> <label for="yearModel">Year:</label> <input type="text" id="yearModel" name="yearModel" class="form-control" required> </div> <!-- div class="form-group"> <label for="views">Views:</label> <input type="text" id="views" name="views" class="form-control" required> </div --> <!-- div class="form-group"> <label for="attributes">Attributes (JSON):</label> <textarea id="attributes" name="attributes" class="form-control" rows="4" required></textarea> </div --> <div class="form-group form-check"> <input type="checkbox" id="delivery_available" name="delivery_available" class="form-check-input" value="1"> <label for="delivery_available" class="form-check-label"><?php echo $_SESSION['property19']; ?>Delivery Available</label> </div> <div class="form-group form-check"> <input type="checkbox" id="negotiable_price" name="negotiable_price" class="form-check-input" value="1"> <label for="negotiable_price" class="form-check-label"><?php echo $_SESSION['property16']; ?>Negotiable Price</label> </div> <div class="form-group"> <label for="status">Status:</label> <input type="text" id="status" name="status" class="form-control" required> </div> <div class="form-group"> <label for="collector">Collector:</label> <input type="text" id="collector" name="collector" class="form-control" required> </div> <input type="hidden" name="form_html" value="<?php echo htmlspecialchars($formHtml); ?>"> <button type="submit" class="btn btn-primary"><?php echo $_SESSION['goNUploadNsell']; ?></button> </form> <h2>Existing Records</h2> <table class="table"> <thead> <tr> <th>ID</th> <th>Images</th> <th>Category</th> <th>Attributes / Delivery Available / Negotiable Price</th> <th>Status</th> <th>Collector</th> </tr> </thead> <tbody> <?php while ($row = $result->fetch_assoc()): ?> <tr> <td><?php echo htmlspecialchars($row['idBathae3i']); ?></td> <td style="max-width:300px;"> <?php $images = explode(',', $row['images']); foreach ($images as $image): ?> <img src="<?php echo htmlspecialchars($image); ?>" alt="Image" style="max-width: 100px; margin-right: 5px;"> <?php endforeach; ?> </td> <td><?php echo htmlspecialchars($row['category']); ?></td> <td><?php /*echo htmlspecialchars($row['attributes']);*/ ?> <?php // Start session if not already started if (session_status() === PHP_SESSION_NONE) { session_start(); } // Decode the JSON-encoded attributes field $attributes = json_decode($row['attributes'], true); ?> <div> <?php $formHtml = $attributes['form_html']; $formData = $attributes['data']; ?> <div class="details-container"> <div class="data-display details-list"> <?php foreach ($formData as $key => $value): ?> <?php // Find the translation for the current key $translation = ''; //foreach ($_SESSION['translations']['category']['vehicles']['cars'] as $category) { foreach ($_SESSION['translations'] as $category) { if (isset($category[$key])) { $translation = $category[$key]; break; }else if (isset($category['vehicles'][$key])) { $translation = $category[$key]; break; } } ?> <li><strong><font color=brown class=_vkey><?php echo htmlspecialchars($translation ?: $key, ENT_QUOTES, 'UTF-8'); ?>:</font></strong> <?php echo htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); ?></li> <?php endforeach; ?> </div> </div> </div> <br /><?php echo $_SESSION['property19']; ?>: <?php echo $row['delivery_available'] ? $_SESSION['yes'] : $_SESSION['no'] ; ?><br /><?php echo $_SESSION['property16']; ?>: <?php echo $row['negotiable_price'] ? $_SESSION['yes'] : $_SESSION['no']; ?></td> <td><?php echo htmlspecialchars($row['status']); ?></td> <td><?php echo htmlspecialchars($row['collector']); ?></td> </tr> <?php endwhile; ?> </tbody> </table> </div> <script> document.querySelector('#images').addEventListener('change', function() { const preview = document.querySelector('#image-preview'); preview.innerHTML = ''; for (const file of this.files) { const reader = new FileReader(); reader.onload = function(e) { const img = document.createElement('img'); img.src = e.target.result; img.alt = 'Image Preview'; preview.appendChild(img); }; reader.readAsDataURL(file); } }); </script> </body> </html>
Form_html:
Data: {"title":"moto sands for me","year":"2025","mileage":"10","condition":"new","engine_capacity":"950","transmission":"automatic","color":"red","service_history":"2024","country":"om","location_city":"nzwa","price":"1450","el3omla":"omr","description":"&lt;?php\r\ninclude_once &quot;settings.php&quot;; // Ensure this file sets up $connessione (database connection)\r\n//include &#039;ar.php&#039;;\r\nif(isset($_GET[&quot;accessCat&quot;])) $_SESSION[&quot;ad&quot;]=$_GET[&quot;accessCat&quot;]; //for the cntrol to dsply ads &amp;&amp; (HIDE) not to display the cars brands logos\r\n$bId = htmlspecialchars($_GET[&#039;bId&#039;] ?? $_GET[&#039;bId&#039;]);\r\n\r\n\r\n// Check if the &#039;accessCat&#039; GET parameter is set\r\n$accessCat = isset($_GET[&#039;accessCat&#039;]) ? $_GET[&#039;accessCat&#039;] : &#039;&#039;;\r\n\r\n// Define available categories and their fields\r\n$categories = $_SESSION[&#039;translations&#039;][&#039;category&#039;];\r\n\r\n\r\n// Process form submission\r\nif ($_SERVER[&#039;REQUEST_METHOD&#039;] === &#039;POST&#039;) {\r\n $category = $connessione-&gt;real_escape_string($_POST[&#039;accessCat&#039;] ?? $_GET[&#039;accessCat&#039;]);\r\n $title = $connessione-&gt;real_escape_string($_POST[&#039;title&#039;] ?? &#039;&#039;);\r\n $berid = $connessione-&gt;real_escape_string($_POST[&#039;berid&#039;] ?? &#039;&#039;);\r\n $hetef = $connessione-&gt;real_escape_string($_POST[&#039;hetef&#039;] ?? &#039;&#039;);\r\n $country = $connessione-&gt;real_escape_string($_POST[&#039;country&#039;] ?? &#039;&#039;);\r\n $location_city = $connessione-&gt;real_escape_string($_POST[&#039;location_city&#039;] ?? &#039;&#039;);\r\n $price = $connessione-&gt;real_escape_string($_POST[&#039;price&#039;] ?? &#039;&#039;);\r\n $el3omla = $connessione-&gt;real_escape_string($_POST[&#039;el3omla&#039;] ?? &#039;&#039;);\r\n $description = $connessione-&gt;real_escape_string($_POST[&#039;description&#039;] ?? &#039;&#039;);\r\n $quantity = $connessione-&gt;real_escape_string($_POST[&#039;quantity&#039;] ?? &#039;&#039;);\r\n $yearModel = $connessione-&gt;real_escape_string($_POST[&#039;yearModel&#039;] ?? $_GET[&#039;year&#039;]);\r\n $views = intval($_POST[&#039;views&#039;] ?? 0);\r\n \r\n //$attributes = $connessione-&gt;real_escape_string($_POST[&#039;attributes&#039;] ?? &#039;&#039;);\r\n // Collect prod attributes data with default values\r\n $attributes__ = [\r\n &#039;brand&#039; =&gt; $_GET[&#039;brand&#039;] ?? &#039;&#039;,\r\n &#039;year&#039; =&gt; $yearModel ?? &#039;&#039;,\r\n &#039;regional_specifications&#039; =&gt; $_POST[&#039;property3&#039;] ?? &#039;&#039;,\r\n &#039;odometer&#039; =&gt; $_POST[&#039;property4&#039;] ?? &#039;&#039;,\r\n &#039;cylinders&#039; =&gt; $_POST[&#039;property5&#039;] ?? &#039;&#039;,\r\n &#039;transmission&#039; =&gt; $_POST[&#039;property6&#039;] ?? &#039;&#039;,\r\n &#039;keys&#039; =&gt; $_POST[&#039;property7&#039;] ?? &#039;&#039;,\r\n &#039;full_options&#039; =&gt; $_POST[&#039;property8&#039;] ?? &#039;&#039;,\r\n &#039;fuel&#039; =&gt; $_POST[&#039;property9&#039;] ?? &#039;&#039;,\r\n &#039;wheel_drive&#039; =&gt; $_POST[&#039;property10&#039;] ?? &#039;&#039;,\r\n &#039;exterior_color&#039; =&gt; $_POST[&#039;property11&#039;] ?? &#039;&#039;,\r\n &#039;interior_color&#039; =&gt; $_POST[&#039;property12&#039;] ?? &#039;&#039;,\r\n &#039;maintenance_report&#039; =&gt; $_POST[&#039;property13&#039;] ?? &#039;&#039;,\r\n &#039;car_status&#039; =&gt; $_POST[&#039;property17&#039;] ?? &#039;&#039;\r\n ];\r\n // Initialize an array to hold form data\r\n $formData = [];\r\n $formHtml = isset($_POST[&#039;form_html&#039;]) ? $_POST[&#039;form_html&#039;] : &#039;&#039;;\r\n // Check if &#039;form_html&#039; is set and is an array\r\nif (isset($_POST[&#039;form_html&#039;]) &amp;&amp; is_array($_POST[&#039;form_html&#039;])) {\r\n foreach ($_POST[&#039;form_html&#039;] as $key =&gt; $value) {\r\n // Sanitize each value\r\n $formData[$key] = htmlspecialchars($value, ENT_QUOTES, &#039;UTF-8&#039;);\r\n }\r\n} else {\r\n echo &#039;Error: form_html is not set or not an array.&#039;;\r\n}\r\n\r\n// Output the sanitized form data\r\nforeach ($formData as $key =&gt; $value) {\r\n echo htmlspecialchars($key) . &#039;: &#039; . htmlspecialchars($value) . &#039;&lt;br&gt;&#039;;\r\n}\r\n \r\n // Build the JSON object for the attributes field\r\n $attributes = [\r\n &#039;form_html&#039; =&gt; $formHtml,\r\n &#039;data&#039; =&gt; $formData\r\n ];\r\n \r\n // Convert the attributes array to a JSON string\r\n $attributesJson = json_encode($attributes);\r\n \r\n // Sanitize the JSON string for safe insertion\r\n $attributes = $connessione-&gt;real_escape_string($attributesJson);\r\n\r\n //$attributes = $connessione-&gt;real_escape_string(json_encode($attributes));\r\n\r\n \r\n $delivery_available = isset($_POST[&#039;delivery_available&#039;]) ? 1 : 0;\r\n $negotiable_price = isset($_POST[&#039;negotiable_price&#039;]) ? 1 : 0;\r\n $status = $connessione-&gt;real_escape_string($_POST[&#039;status&#039;] ?? &#039;&#039;);\r\n $collector = $connessione-&gt;real_escape_string($_POST[&#039;collector&#039;] ?? &#039;&#039;);\r\n\r\n // Handle file uploads\r\n $images = [];\r\n if (isset($_FILES[&#039;images&#039;]) &amp;&amp; !empty($_FILES[&#039;images&#039;][&#039;name&#039;][0])) {\r\n $uploadDir = &#039;uploads/&#039;;\r\n if (!is_dir($uploadDir)) {\r\n mkdir($uploadDir, 0755, true);\r\n }\r\n\r\n foreach ($_FILES[&#039;images&#039;][&#039;tmp_name&#039;] as $key =&gt; $tmp_name) {\r\n $fileName = basename($_FILES[&#039;images&#039;][&#039;name&#039;][$key]);\r\n $uploadFile = $uploadDir . $fileName;\r\n if (move_uploaded_file($tmp_name, $uploadFile)) {\r\n $images[] = $uploadFile;\r\n }\r\n }\r\n }\r\n $imagesList = implode(&#039;,&#039;, $images);\r\n\r\n try {\r\n $sql = mysqli_query($connessione, &quot;INSERT INTO `bathae3i` (\r\n `idBathae3i`, \r\n `images`, \r\n `category`, \r\n `title`, \r\n `berid`, \r\n `hetef`, \r\n `country`, \r\n `location_city`, \r\n `price`, \r\n `el3omla`, \r\n `description`, \r\n `quantity`, \r\n `chronoBathae3`, \r\n `views`, \r\n `attributes`, \r\n `delivery_available`, \r\n `negotiable_price`, \r\n `status`, \r\n `collector`\r\n ) VALUES (\r\n NULL, &#039;$imagesList&#039;, &#039;$category&#039;, &#039;$title&#039;, &#039;$berid&#039;, &#039;$hetef&#039;, &#039;$country&#039;, \r\n &#039;$location_city&#039;, &#039;$price&#039;, &#039;$el3omla&#039;, &#039;$description&#039;, &#039;$quantity&#039;, \r\n &#039;&quot;.time().&quot;&#039;, $views, &#039;$attributes&#039;, $delivery_available, $negotiable_price, \r\n &#039;$status&#039;, &#039;$collector&#039;\r\n )&quot;);\r\n \r\n if (!$sql) {\r\n die(&#039;Error: &#039; . htmlspecialchars($connessione-&gt;error));\r\n }\r\n } catch(Exception $e) {\r\n echo &quot;Exception: &quot; . $e-&gt;getMessage();\r\n }\r\n}\r\n\r\n// Retrieve records from the database\r\n$sql = &quot;SELECT * FROM `bathae3i` WHERE idBathae3i = &#039;&quot; . $bId . &quot;&#039;&quot;;\r\n$result = $connessione-&gt;query($sql);\r\n?&gt;\r\n\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html &lt;?php if(!isset($_SESSION[&#039;lang&#039;]) || $_SESSION[&#039;lang&#039;]==&quot;ar&quot;) echo&quot;lang=ar dir=rtl&quot;; else echo&quot;lang=en dir=ltr&quot;; ?&gt;&gt;\r\n&lt;head&gt;\r\n &lt;meta charset=&quot;UTF-8&quot;&gt;\r\n &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;\r\n &lt;title&gt;Bathae3i Management&lt;/title&gt;\r\n &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css__&quot;&gt;\r\n &lt;style&gt;\r\n body {\r\n &lt;?php if(!isset($_SESSION[&#039;lang&#039;]) || $_SESSION[&#039;lang&#039;]==&quot;ar&quot;) echo&quot;lang=ar dir=rtl&quot;; else echo&quot;lang=en dir=ltr&quot;; ?&gt;\r\n background-color: #f8f9fa;\r\n font-family: Arial, sans-serif;\r\n }\r\n .container {\r\n max-width: 1200px;\r\n margin: 20px auto;\r\n padding: 20px;\r\n background-color: #ffffff;\r\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\r\n border-radius: 8px;\r\n }\r\n .form-control {\r\n display: block;\r\n width: 100%;\r\n height: calc(1.5em + .75rem + 2px);\r\n padding: .375rem .75rem;\r\n margin-top: 3px;\r\n font-size: 1rem;\r\n font-weight: 400;\r\n line-height: 1.5;\r\n color: #495057;\r\n background-color: #fff;\r\n background-clip: padding-box;\r\n border: 1px solid #ced4da;\r\n border-radius: .25rem;\r\n transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;\r\n}\r\n.btn {\r\n display: inline-block;\r\n font-weight: 400;\r\n color: #212529;\r\n text-align: center;\r\n vertical-align: middle;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n background-color: transparent;\r\n border: 1px solid transparent;\r\n padding: .375rem .75rem;\r\n font-size: 1rem;\r\n line-height: 1.5;\r\n border-radius: .25rem;\r\n transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;\r\n}\r\n.btn-primary {\r\n color: #fff;\r\n background-color: #007bff;\r\n border-color: #007bff;\r\n}\r\n h1 {\r\n margin-bottom: 20px;\r\n }\r\n form {\r\n margin-bottom: 30px;\r\n }\r\n .form-group {\r\n margin-bottom: 15px;\r\n }\r\n .form-control, .form-check-input {\r\n border-radius: 4px;\r\n }\r\n .custom-file-input {\r\n display: none;\r\n }\r\n \r\n \r\n .custom-file-upload {\r\n border: 2px solid #007bff;\r\n border-radius: 8px;\r\n display: inline-block;\r\n padding: 12px 24px;\r\n cursor: pointer;\r\n background: linear-gradient(135deg, #007bff 0%, #00d2ff 100%);\r\n color: #ffffff;\r\n text-align: center;\r\n font-weight: bold;\r\n font-size: 16px;\r\n transition: all 0.3s ease;\r\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\r\n position: relative;\r\n }\r\n \r\n .custom-file-upload:hover {\r\n background: linear-gradient(135deg, #00d2ff 0%, #007bff 100%);\r\n color: #f0f0f0;\r\n transform: scale(1.05);\r\n }\r\n \r\n .custom-file-upload:before {\r\n content: &#039;📁 &#039;;\r\n position: absolute;\r\n &lt;?php if(!isset($_SESSION[&#039;lang&#039;]) || $_SESSION[&#039;lang&#039;]==&quot;ar&quot;) echo&quot;right: 0px;&quot;; else echo&quot;left: 0px;&quot;; ?&gt;\r\n top: 40%;\r\n transform: translateY(-50%);\r\n font-size: 18px;\r\n }\r\n \r\n .custom-file-input {\r\n display: none;\r\n }\r\n \r\n .image-preview {\r\n display: flex;\r\n flex-wrap: wrap;\r\n margin-top: 10px;\r\n }\r\n \r\n .image-preview img {\r\n max-width: 100px;\r\n margin-right: 5px;\r\n border-radius: 8px;\r\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\r\n }\r\n \r\n \r\n .image-preview {\r\n display: flex;\r\n flex-wrap: wrap;\r\n margin-top: 10px;\r\n border: 2px dashed #007bff;\r\n border-radius: 8px;\r\n padding: 10px;\r\n background-color: #f8f9fa;\r\n min-height: 120px;\r\n position: relative;\r\n overflow: auto;\r\n }\r\n \r\n .image-preview .placeholder {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n color: #007bff;\r\n font-size: 18px;\r\n font-weight: bold;\r\n text-align: center;\r\n pointer-events: none;\r\n }\r\n \r\n .image-preview img {\r\n max-width: 100px;\r\n margin: 5px;\r\n border-radius: 8px;\r\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\r\n }\r\n\r\n\r\n table {\r\n width: 100%;\r\n border-collapse: collapse;\r\n }\r\n table th, table td {\r\n border: 1px solid #dee2e6;\r\n padding: 12px;\r\n text-align: left;\r\n }\r\n table th {\r\n background-color: #007bff;\r\n color: #ffffff;\r\n }\r\n table td {\r\n background-color: #ffffff;\r\n }\r\n .attributes-list {\r\n white-space: pre-wrap; /* Preserve whitespace for line breaks */\r\n }\r\n \r\n \r\n .details-list {\r\n list-style-type: none;\r\n padding: 0;\r\n margin: 0;\r\n }\r\n .details-list li:nth-child(even) {\r\n background-color: #f9f9f9;\r\n }\r\n .details-list li {\r\n padding: 10px;\r\n border-bottom: 1px solid #eee;\r\n }\r\n .details-container {\r\n background-color: #fff;\r\n border: 1px solid #ddd;\r\n padding: 20px;\r\n margin-bottom: 20px;\r\n font-family: Arial, sans-serif;\r\n width: 100%;\r\n margin: 0 auto;\r\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\r\n }\r\n ._vkey{\r\n &lt;?php if(!isset($_SESSION[&#039;lang&#039;]) || $_SESSION[&#039;lang&#039;]==&quot;ar&quot;) echo&quot;margin-left: 40px;&quot;; else echo&quot;margin-right: 40px;&quot;; ?&gt;\r\n }\r\n &lt;/style&gt;\r\n&lt;/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;div class=&quot;container&quot;&gt;\r\n &lt;h1&gt;Insert New Record&lt;/h1&gt;\r\n\r\n &lt;form method=&quot;post&quot; action=&quot;?accessCat=&lt;?php echo $_GET[&#039;accessCat&#039;]; ?&gt;&amp;brand=&lt;?php echo $_GET[&#039;brand&#039;]; ?&gt;&amp;year=&lt;?php echo $_GET[&#039;year&#039;]; ?&gt;&quot; enctype=&quot;multipart/form-data&quot;&gt;\r\n &lt;!--div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;category&quot;&gt;Category:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;category&quot; name=&quot;accessCat&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div --&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;images&quot; class=&quot;custom-file-upload&quot;&gt;\r\n &lt;span&gt;&lt;?php echo $_SESSION[&quot;imageUpload&quot;]; ?&gt;&lt;/span&gt;\r\n &lt;/label&gt;\r\n &lt;input type=&quot;file&quot; id=&quot;images&quot; name=&quot;images[]&quot; class=&quot;custom-file-input&quot; accept=&quot;image/*&quot; multiple&gt;\r\n &lt;div class=&quot;image-preview&quot; id=&quot;image-preview&quot;&gt;\r\n &lt;div class=&quot;placeholder&quot;&gt;&lt;?php echo $_SESSION[&quot;imagesselected&quot;]; ?&gt;&lt;/div&gt;\r\n &lt;/div&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;title&quot;&gt;Title:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;title&quot; name=&quot;title&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n \r\n &lt;?php if($_GET[&quot;accessCat&quot;]==&quot;cars&quot;)include_once&quot;_carsSpecificities.php&quot;; ?&gt;\r\n &lt;?php //include_once&quot;_vpcategoriesForms.php&quot;; \r\n \r\n \r\n // Function to generate form fields\r\n function generateFormFields($fields) {\r\n $formHtml = &#039;&#039;;\r\n foreach ($fields as $field =&gt; $label) {\r\n if (is_array($label)) { // Check if the field has subvalues\r\n $formHtml .= &#039;&lt;label for=&quot;&#039; . htmlspecialchars($field) . &#039;&quot;&gt;&#039; . htmlspecialchars($label[&#039;type&#039;]) . &#039;:&lt;/label&gt;&#039;;\r\n $formHtml .= &#039;&lt;select id=&quot;&#039; . htmlspecialchars($field) . &#039;&quot; name=&quot;&#039; . htmlspecialchars($field) . &#039;&quot; class=&quot;form-control&quot;&gt;&#039;;\r\n foreach ($label as $subValue =&gt; $subLabel) {\r\n if ($subValue !== &#039;type&#039;) { // Skip the &#039;type&#039; key\r\n $formHtml .= &#039;&lt;option value=&quot;&#039; . htmlspecialchars($subValue) . &#039;&quot;&gt;&#039; . htmlspecialchars($subLabel) . &#039;&lt;/option&gt;&#039;;\r\n }\r\n }\r\n $formHtml .= &#039;&lt;/select&gt;&lt;br&gt;&lt;br&gt;&#039;;\r\n } else {\r\n $formHtml .= &#039;&lt;label for=&quot;&#039; . htmlspecialchars($field) . &#039;&quot;&gt;&#039; . htmlspecialchars($label) . &#039;:&lt;/label&gt;&#039;;\r\n $formHtml .= &#039;&lt;input type=&quot;text&quot; id=&quot;&#039; . htmlspecialchars($field) . &#039;&quot; class=&quot;form-control&quot; name=&quot;&#039; . htmlspecialchars($field) . &#039;&quot; placeholder=&quot;&#039; . htmlspecialchars($label) . &#039;&quot;&gt;&lt;br&gt;&lt;br&gt;&#039;;\r\n }\r\n }\r\n return $formHtml;\r\n }\r\n ?&gt;\r\n \r\n &lt;?php if ($accessCat): ?&gt;\r\n &lt;?php\r\n // Split the selected category into category and subcategory\r\n list($category, $subcategory) = explode(&#039;/&#039;, $accessCat);\r\n \r\n // Check if the selected category and subcategory exist\r\n if (isset($categories[$category][$subcategory])) {\r\n $fields = $categories[$category][$subcategory];\r\n ?&gt;\r\n &lt;h2&gt;&lt;?= htmlspecialchars($subcategory) ?&gt;&lt;/h2&gt;\r\n &lt;div method=&quot;post&quot; class=&quot;_carContainer image-preview&quot;&gt;\r\n &lt;?= generateFormFields($fields) ?&gt;\r\n &lt;!-- input type=&quot;submit&quot; value=&quot;إرسال&quot; --&gt;\r\n &lt;/div&gt;\r\n &lt;?php\r\n } else {\r\n echo &#039;&lt;p class=&quot;error-message&quot;&gt;الفئة أو التصنيف المحدد غير موجود.&lt;/p&gt;&#039;;\r\n }\r\n ?&gt;\r\n &lt;?php endif; ?&gt;\r\n\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;berid&quot;&gt;Berid:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;berid&quot; name=&quot;berid&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;hetef&quot;&gt;Hetef:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;hetef&quot; name=&quot;hetef&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;country&quot;&gt;Country:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;country&quot; name=&quot;country&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;location_city&quot;&gt;City:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;location_city&quot; name=&quot;location_city&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;price&quot;&gt;Price:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;price&quot; name=&quot;price&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;el3omla&quot;&gt;Currency:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;el3omla&quot; name=&quot;el3omla&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;description&quot;&gt;Description:&lt;/label&gt;\r\n &lt;textarea id=&quot;description&quot; name=&quot;description&quot; class=&quot;form-control&quot; rows=&quot;4&quot; required&gt;&lt;/textarea&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;quantity&quot;&gt;Quantity:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;quantity&quot; name=&quot;quantity&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;yearModel&quot;&gt;Year:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;yearModel&quot; name=&quot;yearModel&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;!-- div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;views&quot;&gt;Views:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;views&quot; name=&quot;views&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div --&gt;\r\n\r\n &lt;!-- div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;attributes&quot;&gt;Attributes (JSON):&lt;/label&gt;\r\n &lt;textarea id=&quot;attributes&quot; name=&quot;attributes&quot; class=&quot;form-control&quot; rows=&quot;4&quot; required&gt;&lt;/textarea&gt;\r\n &lt;/div --&gt;\r\n\r\n &lt;div class=&quot;form-group form-check&quot;&gt;\r\n &lt;input type=&quot;checkbox&quot; id=&quot;delivery_available&quot; name=&quot;delivery_available&quot; class=&quot;form-check-input&quot; value=&quot;1&quot;&gt;\r\n &lt;label for=&quot;delivery_available&quot; class=&quot;form-check-label&quot;&gt;&lt;?php echo $_SESSION[&#039;property19&#039;]; ?&gt;Delivery Available&lt;/label&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group form-check&quot;&gt;\r\n &lt;input type=&quot;checkbox&quot; id=&quot;negotiable_price&quot; name=&quot;negotiable_price&quot; class=&quot;form-check-input&quot; value=&quot;1&quot;&gt;\r\n &lt;label for=&quot;negotiable_price&quot; class=&quot;form-check-label&quot;&gt;&lt;?php echo $_SESSION[&#039;property16&#039;]; ?&gt;Negotiable Price&lt;/label&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;status&quot;&gt;Status:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;status&quot; name=&quot;status&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n &lt;div class=&quot;form-group&quot;&gt;\r\n &lt;label for=&quot;collector&quot;&gt;Collector:&lt;/label&gt;\r\n &lt;input type=&quot;text&quot; id=&quot;collector&quot; name=&quot;collector&quot; class=&quot;form-control&quot; required&gt;\r\n &lt;/div&gt;\r\n\r\n \r\n &lt;input type=&quot;hidden&quot; name=&quot;form_html&quot; value=&quot;&lt;?php echo htmlspecialchars($formHtml); ?&gt;&quot;&gt;\r\n &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;&lt;?php echo $_SESSION[&#039;goNUploadNsell&#039;]; ?&gt;&lt;/button&gt;\r\n &lt;/form&gt;\r\n\r\n &lt;h2&gt;Existing Records&lt;/h2&gt;\r\n &lt;table class=&quot;table&quot;&gt;\r\n &lt;thead&gt;\r\n &lt;tr&gt;\r\n &lt;th&gt;ID&lt;/th&gt;\r\n &lt;th&gt;Images&lt;/th&gt;\r\n &lt;th&gt;Category&lt;/th&gt;\r\n &lt;th&gt;Attributes / Delivery Available / Negotiable Price&lt;/th&gt;\r\n &lt;th&gt;Status&lt;/th&gt;\r\n &lt;th&gt;Collector&lt;/th&gt;\r\n &lt;/tr&gt;\r\n &lt;/thead&gt;\r\n &lt;tbody&gt;\r\n &lt;?php while ($row = $result-&gt;fetch_assoc()): ?&gt;\r\n &lt;tr&gt;\r\n &lt;td&gt;&lt;?php echo htmlspecialchars($row[&#039;idBathae3i&#039;]); ?&gt;&lt;/td&gt;\r\n &lt;td style=&quot;max-width:300px;&quot;&gt;\r\n &lt;?php \r\n $images = explode(&#039;,&#039;, $row[&#039;images&#039;]);\r\n foreach ($images as $image): ?&gt;\r\n &lt;img src=&quot;&lt;?php echo htmlspecialchars($image); ?&gt;&quot; alt=&quot;Image&quot; style=&quot;max-width: 100px; margin-right: 5px;&quot;&gt;\r\n &lt;?php endforeach; ?&gt;\r\n &lt;/td&gt;\r\n &lt;td&gt;&lt;?php echo htmlspecialchars($row[&#039;category&#039;]); ?&gt;&lt;/td&gt;\r\n &lt;td&gt;&lt;?php /*echo htmlspecialchars($row[&#039;attributes&#039;]);*/ ?&gt;\r\n \r\n &lt;?php\r\n // Start session if not already started\r\n if (session_status() === PHP_SESSION_NONE) {\r\n session_start();\r\n }\r\n \r\n // Decode the JSON-encoded attributes field\r\n $attributes = json_decode($row[&#039;attributes&#039;], true);\r\n ?&gt;\r\n &lt;div&gt;\r\n &lt;?php\r\n $formHtml = $attributes[&#039;form_html&#039;];\r\n $formData = $attributes[&#039;data&#039;];\r\n ?&gt;\r\n &lt;div class=&quot;details-container&quot;&gt;\r\n &lt;div class=&quot;data-display details-list&quot;&gt; \r\n &lt;?php foreach ($formData as $key =&gt; $value): ?&gt;\r\n &lt;?php\r\n // Find the translation for the current key\r\n $translation = &#039;&#039;;\r\n //foreach ($_SESSION[&#039;translations&#039;][&#039;category&#039;][&#039;vehicles&#039;][&#039;cars&#039;] as $category) {\r\n foreach ($_SESSION[&#039;translations&#039;] as $category) {\r\n if (isset($category[$key])) {\r\n $translation = $category[$key];\r\n break;\r\n }else if (isset($category[&#039;vehicles&#039;][$key])) {\r\n $translation = $category[$key];\r\n break;\r\n }\r\n }\r\n ?&gt;\r\n &lt;li&gt;&lt;strong&gt;&lt;font color=brown class=_vkey&gt;&lt;?php echo htmlspecialchars($translation ?: $key, ENT_QUOTES, &#039;UTF-8&#039;); ?&gt;:&lt;/font&gt;&lt;/strong&gt; &lt;?php echo htmlspecialchars($value, ENT_QUOTES, &#039;UTF-8&#039;); ?&gt;&lt;/li&gt;\r\n &lt;?php endforeach; ?&gt;\r\n &lt;/div&gt;\r\n &lt;/div&gt;\r\n &lt;/div&gt;\r\n\r\n\r\n \r\n \r\n &lt;br /&gt;&lt;?php echo $_SESSION[&#039;property19&#039;]; ?&gt;: &lt;?php echo $row[&#039;delivery_available&#039;] ? $_SESSION[&#039;yes&#039;] : $_SESSION[&#039;no&#039;] ; ?&gt;&lt;br /&gt;&lt;?php echo $_SESSION[&#039;property16&#039;]; ?&gt;: &lt;?php echo $row[&#039;negotiable_price&#039;] ? $_SESSION[&#039;yes&#039;] : $_SESSION[&#039;no&#039;]; ?&gt;&lt;/td&gt;\r\n &lt;td&gt;&lt;?php echo htmlspecialchars($row[&#039;status&#039;]); ?&gt;&lt;/td&gt;\r\n &lt;td&gt;&lt;?php echo htmlspecialchars($row[&#039;collector&#039;]); ?&gt;&lt;/td&gt;\r\n &lt;/tr&gt;\r\n &lt;?php endwhile; ?&gt;\r\n &lt;/tbody&gt;\r\n &lt;/table&gt;\r\n&lt;/div&gt;\r\n\r\n&lt;script&gt;\r\ndocument.querySelector(&#039;#images&#039;).addEventListener(&#039;change&#039;, function() {\r\n const preview = document.querySelector(&#039;#image-preview&#039;);\r\n preview.innerHTML = &#039;&#039;;\r\n for (const file of this.files) {\r\n const reader = new FileReader();\r\n reader.onload = function(e) {\r\n const img = document.createElement(&#039;img&#039;);\r\n img.src = e.target.result;\r\n img.alt = &#039;Image Preview&#039;;\r\n preview.appendChild(img);\r\n };\r\n reader.readAsDataURL(file);\r\n }\r\n});\r\n&lt;/script&gt;\r\n\r\n&lt;/body&gt;\r\n&lt;/html&gt;\r\n","quantity":"1","yearModel":"2025","negotiable_price":"1","status":"new","collector":"no"}