79245625

Date: 2024-12-02 21:25:20
Score: 3
Natty:
Report link

Just ran on PHP 8.2.23, WP 6.7.1, it worked fine. I just added an example php array, $ReptileID, and it worked fine. Via this code:

            <?php
        // Simulating a list of fake reptile IDs for testing purposes
        $ReptileID = [
            '001',
            '002',
            '003',
            '004',
            '005',
            '006',
            '007'
        ];
        ?>
    <label for="licensetag">Choose A Reptile ID:</label>
    <select name="license" id="license">
        <?php foreach ($ReptileID as $ReptileID): ?>
            <option value="<?php echo $ReptileID; ?>">
                <?php echo $ReptileID; ?>
            </option>
        <?php endforeach; ?>
    </select>
    <script>
    const dropdown = document.getElementById("license");
    dropdown.addEventListener("change", function() {
        const selectedValue = dropdown.value;
        console.log("Selected value:", selectedValue);
        <?php echo "selectedValue"; ?>
        // Do something with the selected value, e.g., pass it to a function
        pullWeights(selectedValue);
    });
    </script>

Sample outputs: (1) Selected value: 003 (2) Uncaught ReferenceError: pullWeights is not defined. What PHP & WP versions are you using? What else is going on within your file? Can you post your code to a publicly accessible place such as codesandbox or codepen?

Reasons:
  • Whitelisted phrase (-1): it worked
  • RegEx Blacklisted phrase (2.5): Can you post your code
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: user28519550