Swiper Javascript not working on my site but working local

I wanted to add a slider to my own site with the Elementor “HTML” plugin. I tested it on localhost but it didn’t work when it came to the site. On my WordPress based site, only the first image and text worked, but when I scrolled with the button, a white and blank page appeared. The reason for this is probably something blocking it on my site, but I couldn’t find it. I would be very happy if you could help me.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"/>

<!-- Galeri -->
<div class="gallery-wrapper">
  <!-- Ana Swiper -->
  <div class="swiper mySwiperMain">
    <div class="swiper-wrapper">
      <div class="swiper-slide">
        <div class="image-box">
          <img src="https://i.ibb.co/Nng62bWf/IMG-20250421-WA0022.jpg" alt="Mavi">
          <div class="slide-text-container">
            <div class="slide-title-fixed">Renk Seçenekleri:</div>
            <div class="slide-text">Mavi</div>
          </div>
        </div>
      </div>
      <div class="swiper-slide">
        <div class="image-box">
          <img src="https://i.ibb.co/HMBBKCB/IMG-20250421-WA0023.jpg" alt="Beyaz">
          <div class="slide-text-container">
            <div class="slide-title-fixed">Renk Seçenekleri:</div>
            <div class="slide-text">Beyaz</div>
          </div>
        </div>
      </div>
      <div class="swiper-slide">
        <div class="image-box">
          <img src="https://i.ibb.co/3ycNMytq/IMG-20250421-WA0024.jpg" alt="Turkuaz">
          <div class="slide-text-container">
            <div class="slide-title-fixed">Renk Seçenekleri:</div>
            <div class="slide-text">Turkuaz</div>
          </div>
        </div>
      </div>
    </div>
    <div class="swiper-button-next custom-next"></div>
  </div>

  <!-- Thumbnail Swiper -->
  <div class="swiper mySwiperThumb">
    <div class="swiper-wrapper">
      <div class="swiper-slide"><img src="https://i.ibb.co/Nng62bWf/IMG-20250421-WA0022.jpg" alt=""></div>
      <div class="swiper-slide"><img src="https://i.ibb.co/HMBBKCB/IMG-20250421-WA0023.jpg" alt=""></div>
      <div class="swiper-slide"><img src="https://i.ibb.co/3ycNMytq/IMG-20250421-WA0024.jpg" alt=""></div>
    </div>
  </div>
</div>

<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-element-bundle.min.js"></script>

<!-- Swiper Ayarları -->
<script>
  window.addEventListener('DOMContentLoaded', () => {
    const swiperThumb = new Swiper(".mySwiperThumb", {
      spaceBetween: 10,
      slidesPerView: 3,
      freeMode: true,
      watchSlidesProgress: true,
    });

    const swiperMain = new Swiper(".mySwiperMain", {
      spaceBetween: 10,
      navigation: {
        nextEl: '.custom-next',
      },
      loop: false, // Loop sorun çıkarıyordu
      thumbs: {
        swiper: swiperThumb,
      },
    });
  });
</script>

<!-- Stil -->
<style>
  body {
    background: #111;
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
  }

  .gallery-wrapper {
    position: relative;
    max-width: 1500px;
    margin: auto;
  }

  .swiper.mySwiperMain {
    border-radius: 15px;
    overflow: hidden;
    position: relative;
  }

  .image-box {
    position: relative;
  }

  .image-box img {
    width: 100%;
    display: block;
  }

  .slide-text-container {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .slide-title-fixed {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: normal;
  }

  .slide-text {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
  }

  .mySwiperThumb {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    width: auto;
    height: auto;
  }

  .mySwiperThumb .swiper-slide {
    width: 75px !important;
    height: 50px;
    opacity: 1 !important;
    transition: none !important;
    transform: none !important;
  }

  .mySwiperThumb .swiper-slide-thumb-active {
    border: 2px solid white;
    border-radius: 6px;
  }

  .mySwiperThumb .swiper-slide img {
    width: 100%;
    border-radius: 6px;
  }

  .swiper-button-next.custom-next {
    color: white;
    background: dodgerblue;
    padding: 0;
    border-radius: 1px;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .swiper-button-next.custom-next::after {
    font-size: 22px;
    font-weight: bold;
  }
</style>

Live error: https://www.pondhavuz.com/fiber-havuzlar/

What is needed to get a simple instance of JBCefBrowser up and running to execute JavaScript?

I’m working on making a possible contribution the Community Edition of Intellij IDEA, adding some enhancements to the Markdown preview feature.

The IDEA code base is primarily Java and Java’s cousin, Kotlin. There is, however, some other open-source code I want to leverage, highlight.js, that’s written it JavaScript.

I’ve found a functional way to get highlight.js to work for me in this code environment, but it took some ugly and unsatisfactory hacking to do it. I think I have the basic elements for a better solution in place, but just can’t get it to actually work.

This is the start of what I hope to be a less kludgy way of running JavaScript code:

var browser = JBCefBrowser()

browser.jbCefClient.addDisplayHandler(object: CefDisplayHandlerAdapter() {
  override fun onConsoleMessage(browser: CefBrowser, level: CefSettings.LogSeverity,
    message: String, source: String, line: Int
  ): Boolean {
    println(message) // <-- Should reach this code, but it's not happening
    return false
  }
}, browser.cefBrowser)

browser.executeJavaScript("console.info('Hello, world.')")

If you’re already feeling a little TL;DR at this point, you can skip past the following explanation of how I arrived here and go to the end of the post for the specific problem I’m running into.

IDEA uses JCEFBrowser (JCEF: Java Chromium Embedded Framework) for a number of things, including for its Markdown preview. Such browsers are capable of executing JavaScript code, so taking advantage of that seems to make a lot more sense that dragging in an additional heavy-weight dependency like GraalVM to run highlight.js.

As the IDEA code is set up, however, the MarkdownJCEFHtmlPanel implementation of a JCEFBrowser can only work on changing code fence highlighting a bit late in the game, after all processing for syntax highlighting should have already been done. With my current solution the user momentarily sees un-highlighted code until the JavaScript running in MarkdownJCEFHtmlPanel locates the code fence contents and then applies highlight.js highlighting.

This results in noticeable flicker when code fence contents are being edited. Without some additional ugly hacking, every code fence had flickered when anything was edited anywhere.

Hence the alternate solution I’m trying to find, and the problem with that solution so far: For reasons I don’t understand the extra JBCefBrowser instance I’m creating is totally unresponsive, dead in the water and not helping me to do anything.

I get no errors and no warnings, just nothing useful happens. Things like waitForPageLoad hang forever.

Does the JCEFBrowser, even if it’s meant to be offscreen, need to be attached to a live view of some sort? Does the browser need to be registered somewhere so that it receives processing time and/or event dispatches?

The debugger tells me browser.cefBrowser.hasDocument() is always false, so I’m sure that’s not a good sign.

I feel like there’s some missing initialization or other form of a kick in the pants needed to get this JBCefBrowser instance up and running in a fully functional state.

Can anyone suggest what that might be?

How to create an outline for an image?

I’m currently using CSS,HTML, and React. I’m trying to make my UI interactable by allowing users to hover over an image, and the outline of the object will be highlighted. I searched multiple threads on how to do it but to no avail. I removed the background of each image but still for some reason when I highlight the outlines, it re-colors the background to a green hue. I do not know how the filter is doing this when I removed the background of the image. The image is a png file.

Here’s what I’m trying to do
What it should look like

Here’s what actually happened:
What it actually looks like

I tried looking through past threads, but they don’t solve the problem.
Here is the CSS File:

html {
  background: gray;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

img {
  user-select: none;
  height: 500px;
  width: 500px;
}

.image-w-bg {
  filter: drop-shadow(5px 0 0 green) 
  drop-shadow(0 5px 0 green)
  drop-shadow(-5px 0 0 green) 
  drop-shadow(0 -5px 0 green);
}

Here is where I inserted the image into the page:
return <img className='image-w-bg' src={designImage} alt="Me" />;

How to derive remaining forest mask from Hansen treecover2000 and lossyear in GEE?

I’m loading the Hansen Global Forest Change data, creating three layers:

forest2000 – all pixels with ≥20% tree cover in 2000

forestLoss2002 – all pixels that lost tree cover in 2001

remainingForest2002 – what’s left of forest2000 after removing losses through 2001

I’d expect that, if you toggle on Layer 1 (green) and Layer 2 (red), then Layer 3 (cyan) would be exactly the green minus the red. However, when I inspect them in the map viewer, they don’t line up as perfect complements. Some “cyan” remains where I still see red pixels, and vice versa.

Here’s a minimized version of my script:

// 1. Load Hansen data
var hansen        = ee.Image('UMD/hansen/global_forest_change_2023_v1_11');
var tree2000      = hansen.select('treecover2000');
var lossyear      = hansen.select('lossyear');

// 2. Baseline forest mask (≥20% cover in 2000)
var forest2000 = tree2000.gte(20).selfMask();

// 3. Loss mask: pixels lost in 2001 only
var lossMask2002     = lossyear.gt(0).and(lossyear.lte(1));
var forestLoss2002 = lossMask2002.updateMask(forest2000);

// 4. Remaining forest after 2001 loss
var remainingForest2002 = forest2000.updateMask(lossMask2002.not());

// 5. Display
Map.addLayer(forest2000,         {palette:['green']}, 'Forest2000');
Map.addLayer(forestLoss2002,     {palette:['red']},   'Loss2001');
Map.addLayer(remainingForest2002,{palette:['cyan']},  'Remaining2002');

I loaded the Hansen Global Forest Change image in Earth Engine and created three layers: the baseline forest mask for ≥20 % tree cover in 2000; a loss mask for pixels that lost cover in 2001; and finally a “remaining forest” mask obtained by inverting the loss mask on the baseline. I displayed all three layers together in the map viewer.

What I expected
I expected every red loss pixel to fall entirely within the green forest2000 area, and the cyan remaining‑forest layer to exactly fill all parts of the green layer that were not marked as red. In other words, red and cyan should partition the green without overlap or gaps.

What actually happened
Instead,cyan sometimes overlapped red or left gaps inside the green.

I can’t get Tailwind 4 to work with Next.js 15

I just can’t get it to work, the border classes are being override by something and can’t figure it out, any ideas?

I’ve tried downgrading to Tailwind 3 but no luck.

Tailwind version: 4.1.4
Postcss version: 4.1.4
Next.js version: 15.3.1

postcss.config.js

const config = {
  plugins: {
    '@tailwindcss/postcss': {},
  },
};
export default config;

app/layout.tsx

import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: "Next.js Calculator",
  description: "A simple Next.js calculator",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      >
        {children}
      </body>
    </html>
  );
}

app/global.css

@import "tailwindcss";

app/page.tsx

export default function Home() {
  return (
    <div>
      <input className="border-solid border-black rounded-md" type="text" disabled />
    </div>
  );
}

After trying to add signoz to nextjs app, error shows up

i am trying to add my app to signoz, and as per documentation i have added

'use strict'
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';

// Add otel logging
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR); // set diaglog level to DEBUG when debugging

const exporterOptions = {
  url: 'http://localhost:4318/v1/traces', // Endpoint of SigNoz/Otel Collector
}

export const traceExporter = new OTLPTraceExporter(exporterOptions);

and

import { registerOTel } from '@vercel/otel';
import { traceExporter } from './instrumentation.node';

export function register() {
  registerOTel({
    serviceName: 'Apple_Music_Art',
    traceExporter: traceExporter,
  });
}

but i just get an error:

{
    "stack": "TypeError: Cannot read properties of undefined (reading 'name') at createResourceMap (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9181:72) at spanRecordsToResourceSpans (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9192:25) at createExportTraceServiceRequest (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9169:24) at Object.serializeRequest (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9237:257) at OTLPExportDelegate.export (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9880:52) at OTLPTraceExporter.export (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:8730:30) at s (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2563:115) at D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2567:38 at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14) at Du.with (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:6488:44) at ContextAPI.with (D:\better-projects\apple-music-covers\node_modules\@opentelemetry\api\build\src\api\context.js:60:46) at D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2562:32 at new Promise (<anonymous>) at Go._flushOneBatch (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2558:95) at e (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2579:46) at Timeout.<anonymous> (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2586:69) at listOnTimeout (node:internal/timers:611:17) at process.processTimers (node:internal/timers:546:7)",
    "message": "Cannot read properties of undefined (reading 'name')",
    "name": "TypeError"
}

An idiom for async functions with “busy” indication and progress logging?

I’m working on some JS code (which will run within Thunderbird, but that’s not the main point). This code is kind of old, and does asynchronous work using setTimeout(); I want to transition it to using async functions, await, and try-catch for possible errors. I’m a newbie with regard to their use.

The thing is, that asynchronous code is something I want the app GUI to be reflective of, in the following sense:

  • I want to indicate that the app is busy / running something while my top-level async function is running (never mind sub-functions and such)
  • I want to be able to tell my async function that the user asked to abort it
  • I want my async function to be able to occasionally report its status (e.g. via setting the text of the status bar mmedage)

I realize these are app-specific desires, but they could be made actionable using some generic interface (exposed by my code or for my code to see). My question is, therefore – is there some kind of idiom for doing this with one, or both, of my side-desires?

TypeError: dataTable.addRows is undefined in Charts.newDataTable()

I’m encountering a very strange issue in Google Apps Script and I’m hoping someone can shed some light on it. I’m getting a TypeError: dataTable.addRows is not a function when trying to build a DataTable for charts using Charts.newDataTable().

Here’s a minimal code snippet that reproduces the issue:

function testDataTable() {
  var dataTable = Charts.newDataTable();
  Logger.log(typeof dataTable.addColumn); // Output: "function"
  Logger.log(typeof dataTable.addRows);   // Output: "undefined"
}

As you can see, addColumn seems to be available, but addRows is unexpectedly undefined. This is preventing me from creating any charts.

My environment:

  • Google Account Type: Personal (@gmail.com)
  • Script Location: Testing in both a script bound to a Google Sheet and a standalone script.

Steps I’ve tried:

  • Double-checking the syntax for creating the DataTable.
  • Trying different ways to chain the methods.
  • Testing the minimal code above in a brand new Apps Script project.
    The issue persists even in a new project, with addRows consistently being reported as undefined.

Has anyone else experienced this issue, or does anyone have any insights into why addRows might be missing from the Charts.newDataTable() object?

React form time validation not working – alert not showing when start time is later than end time [duplicate]

`I’m working on a scheduling feature in a React project where teachers can update their available hours. The form includes start time and end time fields. My goal is to show an alert if the start time is greater than or equal to the end time, but the alert doesn’t show when I input an invalid range (e.g. start time 11:00, end time 10:00).

Here is my handleSubmit function logic

const handleSubmit = async (e) => {`
    e.preventDefault();
    if (!formData.startTime || !formData.endTime) {
      alert("Please select both start and end time.");
      return;
    }

    try {
      const startTimeStr = formData.startTime.padEnd(5, ":00").slice(0, 5);
      const endTimeStr = formData.endTime.padEnd(5, ":00").slice(0, 5);
      if (startTimeStr >= endTimeStr) {
        alert("Start time must be earlier than end time");
        return;
      }

      const updatedData = {
        date: formData.date,
        day: formData.day,
        startTime: formData.startTime,
        endTime: formData.endTime,
      };

      await updateAvailhours(selectedHour._id, updatedData);

      fetchAvailableHours();

      setIsModalOpen(false);
      alert("Available hour updated successfully!");
    } catch (error) {
      console.error("Update failed:", error);
      alert(
        "Failed to update. " + (error.response?.data?.message || "Try again.")
      );
    }
  };

Despite this logic, when I enter startTime = “11:00” and endTime = “10:00”, it doesn’t show the alert or stop the form submission. The form proceeds as if everything is valid.

Logging startMinutes and endMinutes values — they appear correct.
Wrapping the logic in try…catch — no error is thrown.
Checking input values manually in the UI — the values are correctly typed.
Ensuring no required attribute interferes with validation (still happens).

Why the startMinutes >= endMinutes condition is not stopping the form.
Whether e.preventDefault() is being bypassed.
A better way to handle this kind of time validation in React forms.`

Object is not being deleted from array after interecting with input checkbox

I am trying to achieve the following:

When input checkbox is true:

  • Add object to sites array state and local storage

When input checkbox is false:

  • Delete object from sites array state and local storage

The problem I experience right now is my setSites state updating function is not removing the object from local storage or from sites state

Heres method I use to delete the object and also remove from local storage(suggested via React docs here)

const index = sites.findIndex((site) => site.url.includes(domain));
setSites(sites.filter((site, i) => index !== site[i]));

Heres full app.jsx where I run the above from handleLogs() function

import React, { useState, useEffect } from 'react';
import { createRoot } from 'react-dom/client';

const App = () => {
  const [sites, setSites] = useState([]);

  useEffect(() => {
    chrome.storage.local.get(['sites'], (res) => {
      if (res.sites) {
        setSites(res.sites);
        console.log(`Loaded from storage`, res.sites);
      }
    });
  }, []);

  useEffect(() => {
    chrome.storage.local.set({ sites });
    console.log('Saved to storage:', sites);
  }, [sites]);

  function handleLogs(event) {
    chrome.tabs.query({ active: true, lastFocusedWindow: true }, (tabs) => {
      const domain = tabs[0].url.split('/')[2];
      const fullURL = tabs[0].url;

      if (event.target.checked === false) {
        // remove current site from sites array
        const index = sites.findIndex((site) => site.url.includes(domain));
        setSites(sites.filter((site, i) => index !== site[i]));

        // store new sites in local storage
        chrome.storage.local.set({ sites });

        // remove ?tracking
        const newUrl = fullURL.replace('?tracking', '');
        chrome.tabs.update(tabs[0].id, { url: newUrl });
      } else {
        if (fullURL.includes('?tracking')) {
          console.log('Url already contains tracking');
          return;
        }

        // push new site to array and save to local storage
        setSites((prevSites) => [
          ...prevSites,
          { url: domain }
        ]);
        chrome.storage.local.set({ sites });

        // Decorate URL with parameter
        const params = encodeURI('tracking');
        const url = tabs[0].url;
        const hashStart =
          url.indexOf('#') === -1 ? url.length : url.indexOf('#');
        const querySymbol = url.indexOf('?') === -1 ? '?' : '&';
        var newUrl = `${url.substring(
          0,
          hashStart
        )}${querySymbol}${params}${url.substring(hashStart)}`;

        // Refresh page with new URL
        chrome.tabs.update(tabs[0].id, { url: newUrl });
      }
    });
  }

  return <input type="checkbox" onClick={(event) => handleLogs(event)} />;
};

const container = document.createElement('div');
document.body.appendChild(container);
const root = createRoot(container);
root.render(<App />);

A bit tricky to debug this in browser as Webpack process is outputting bundled file. Still working on it. But, what am I doing wrong here?

Where is the problem in the code?php,JavaScript,html [closed]

I can’t understand why my code doesn’t work. Values ​​are obtained from the database.

file Db_get.php:

<?php

function db_get (mixed $table_name) : mixed
{
    $db= new PDO('sqlite:db.db');
    $stmt=$db->prepare("SELECT * FROM `$table_name` ORDER BY 1 DESC LIMIT 1;");
    $stmt->execute();
    $table=$stmt->fetchall(PDO::FETCH_ASSOC);


    return $table;
}

file Form_1.php:

<?php
function form_function_1(mixed $unit_of_measurement, mixed $sensor_name, mixed $sensor_value){


if (isset($_GET['value1'])) {
    $value = $_GET['value1'];
} else {
    $value = $sensor_value;
}

if (isset($_GET['checkbox_value1'])) {
    $checkbox_value = $_GET['checkbox_value1'];
} else {
    $checkbox_value = '';
}
?>


<form method="GET" id="myForm1">
    <?php echo $sensor_name;
    echo "&nbsp;&nbsp;";
    echo $unit_of_measurement;

    ?>

    <input type="text" name="value1" value="<?php echo $value; ?>"
        <?php
        if (empty($checkbox_value)) {
            echo 'disabled';
        }
        ?>>

    <input type="checkbox" id="myCheckbox1" name="checkbox_value1" value="1"
        <?php
        if (!empty($checkbox_value)) {
            echo 'checked';
        }
        ?>>

    <input type="submit" value="Send" <?php if (empty($checkbox_value)){echo 'disabled';}?>>

</form>

<script>
    
    function sendForm() {
        document.getElementById("myForm1").submit();
    }

    
    document.querySelector('#myCheckbox1').addEventListener('change', function() {
        const inputValue = document.querySelector('input[name="value1"]');

        
        if (!this.checked) {
           
            inputValue.value = <?php echo $sensor_value; ?>;
            inputValue.disabled = true;
        } else {
    
            inputValue.disabled = false;
        }

        sendForm();
    });

   
    if (document.querySelector('#myCheckbox1').checked) {
        document.querySelector('input[name="value1"]').disabled = false;
    } else {
        document.querySelector('input[name="value1"]').disabled = true;
    }
</script>

    <?php
}
?>

file Form_2.php:

<?php
function form_function_2(mixed $unit_of_measurement, mixed $sensor_name, mixed $sensor_value){
if (isset($_GET['value2'])) {
    $value = $_GET['value2'];
} else {
    $value = $sensor_value;
}

if (isset($_GET['checkbox_value2'])) {
    $checkbox_value = $_GET['checkbox_value2'];
} else {
    $checkbox_value = '';
}
?>

        
<form method="GET" id="myForm2">
    <?php echo $sensor_name;
    echo "&nbsp;&nbsp;";
    echo $unit_of_measurement;

    ?>

    <input type="text" name="value2" value="<?php echo $value; ?>"
        <?php
        if (empty($checkbox_value)) {
            echo 'disabled';
        }
        ?>>

    <input type="checkbox" id="myCheckbox2" name="checkbox_value2" value="1"
        <?php
        if (!empty($checkbox_value)) {
            echo 'checked';
        }
        ?>>

    <input type="submit" value="Send" <?php if (empty($checkbox_value)){echo 'disabled';}?>>

</form>

<script>

    function sendForm() {
        document.getElementById("myForm2").submit();
    }

    document.querySelector('#myCheckbox2').addEventListener('change', function() {
        const inputValue = document.querySelector('input[name="value2"]');

        if (!this.checked) {
            
            inputValue.value = <?php echo $sensor_value; ?>;
            inputValue.disabled = true;
        } else {

            inputValue.disabled = false;
        }

        sendForm();
    });

    if (document.querySelector('#myCheckbox2').checked) {
        document.querySelector('input[name="value2"]').disabled = false;
    } else {
        document.querySelector('input[name="value2"]').disabled = true;
    }
</script>
<?php
}
?>

file Settings_start:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Settings</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<?php
include "Form_1.php";
include "Form_2.php";
include "Db_get.php";
$table_Pressure=db_get('Pressure');
$table_Temperature=db_get('Temperature');

form_function_1($table_Pressure[0]['unit_of_measurement'],$table_Pressure[0]['sensor_name'],$table_Pressure[0]['value']);
form_function_2($table_Temperature[0]['unit_of_measurement'],$table_Temperature[0]['sensor_name'],$table_Temperature[0]['value']);
?>
</html>

For some reason, the function that is called first does not work correctly. I tried to rearrange the function call, but the problem is still in the function that is called first. The incorrect operation of the function is that when you select a checkbox, a request is sent (automatically) and the checkbox immediately ceases to be selected, accordingly the send button becomes unavailable, and you cannot enter anything into the form.
The problem is that the checkbox stops being selected.

I don’t know exactly what language the problem is.
But presumably JavaScript.
There were no error messages.
The problem occurs when calling functions form_function_1 and form_function_1.

How to set basename for react-router v7 framework mode?

I have created a React-Router framework mode app like this:

npx create-react-router@latest my-react-router-app

The version of React-Router is:

"react-router": "^7.5.1"

In routes.ts I have added a bunch of pages:

export default [
  index("routes/login.tsx"),
  route("menu", "routes/menu.tsx"),
  route("skills", "routes/skills.tsx"),
  route("courses", "routes/courses.tsx"),
] satisfies RouteConfig;

Everything is working just fine during development. Now, I need to deploy this app in the "/courses" folder of the web server’s document root (I have server side rendering disabled in react-router.config.ts). I cannot find any updated information on how to set the basename to "/courses". Most of the information seems outdated. How do I configure the basename in framework mode?

Why my js code doesn’t work? php, html, js [closed]

I can’t understand why my code doesn’t work. Values ​​are obtained from the database.

file Db_get.php:

<?php

function db_get (mixed $table_name) : mixed
{
    $db= new PDO('sqlite:db.db');
    $stmt=$db->prepare("SELECT * FROM `$table_name` ORDER BY 1 DESC LIMIT 1;");
    $stmt->execute();
    $table=$stmt->fetchall(PDO::FETCH_ASSOC);


    return $table;
}

file Form_1.php:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<?php

function form_function_1(mixed $unit_of_measurement, mixed $sensor_name, mixed $sensor_value){

if (isset($_GET['value1'])) {
    $value = $_GET['value1'];
} else {
    $value = $sensor_value;
}

if (isset($_GET['checkbox_value1'])) {
    $checkbox_value = $_GET['checkbox_value1'];
} else {
    $checkbox_value = '';
}
?>

<form method="GET" id="myForm1">
    <?php echo $sensor_name;
        echo "&nbsp;&nbsp;";
        echo $unit_of_measurement;
    ?>

    <input type="text" name="value1" value="<?php echo $value; ?>"
        <?php
            if (empty($checkbox_value)) {
                echo 'disabled';
            }
        ?>>

    <input type="checkbox" id="myCheckbox1" name="checkbox_value1" value="1"
        <?php
            if (!empty($checkbox_value)) {
                echo 'checked';
            }
        ?>>

    <input type="submit" value="Send" <?php if (empty($checkbox_value)){echo 'disabled';}?>>

</form>

<script>
    function sendForm() {
        document.getElementById("myForm1").submit();
    }

    document.querySelector('#myCheckbox1').addEventListener('change', function() {
        const inputValue = document.querySelector('input[name="value1"]');

        
        if (!this.checked) { 
            inputValue.value = <?php echo $sensor_value; ?>;
            inputValue.disabled = true;
        } else {
            inputValue.disabled = false;
        }
        sendForm();
    });

    
    if (document.querySelector('#myCheckbox1').checked) {
        document.querySelector('input[name="value1"]').disabled = false;
    } else {
        document.querySelector('input[name="value1"]').disabled = true;
    }
</script>

</body>
</html>
<?php
}
?>

file Form_2.php:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<?php


function form_function_2(mixed $unit_of_measurement, mixed $sensor_name, mixed $sensor_value){
        
if (isset($_GET['value2'])) {
    $value = $_GET['value2'];
} else {
    $value = $sensor_value;
}

if (isset($_GET['checkbox_value2'])) {
    $checkbox_value = $_GET['checkbox_value2'];
} else {
    $checkbox_value = '';
}
?>

<form method="GET" id="myForm2">
    <?php echo $sensor_name;
        echo "&nbsp;&nbsp;";
        echo $unit_of_measurement;
    ?>

    <input type="text" name="value2" value="<?php echo $value; ?>"
        <?php
            if (empty($checkbox_value)) {
                echo 'disabled';
            }
        ?>>

    <input type="checkbox" id="myCheckbox2" name="checkbox_value2" value="1"
        <?php
            if (!empty($checkbox_value)) {
                echo 'checked';
            }
        ?>>

    <input type="submit" value="Send" <?php if (empty($checkbox_value)){echo 'disabled';}?>>

</form>

<script>
    function sendForm() {
        document.getElementById("myForm2").submit();
    }

    document.querySelector('#myCheckbox2').addEventListener('change', function() {
        const inputValue = document.querySelector('input[name="value2"]');

        if (!this.checked) {
            inputValue.value = <?php echo $sensor_value; ?>;
            inputValue.disabled = true;
        } else {
            inputValue.disabled = false;
        }

        sendForm();
    });

    if (document.querySelector('#myCheckbox2').checked) {
        document.querySelector('input[name="value2"]').disabled = false;
    } else {
        document.querySelector('input[name="value2"]').disabled = true;
    }
</script>

</body>
</html>
<?php
}
?>

file Settings_start:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Settings</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<?php
include "Form_1.php";
include "Form_2.php";
include "Db_get.php";
$table_Pressure=db_get('Pressure');
$table_Temperature=db_get('Temperature');

form_function_1($table_Pressure[0]['unit_of_measurement'],$table_Pressure[0]['sensor_name'],$table_Pressure[0]['value']);
form_function_2($table_Temperature[0]['unit_of_measurement'],$table_Temperature[0]['sensor_name'],$table_Temperature[0]['value']);
?>
</html>

For some reason, the function that is called first does not work correctly. I tried to rearrange the function call, but the problem is still in the function that is called first. The incorrect operation of the function is that when you select a checkbox, a request is sent (automatically) and the checkbox immediately ceases to be selected, accordingly the send button becomes unavailable, and you cannot enter anything into the form.
There were no error messages.