• February 19, 2023
    <!DOCTYPE html>
    <html>
      <head>
        <title>Form Submission Example</title>
      </head>
      <body>
        <form method="POST" action="">
          <label for="name">Name:</label>
          <input type="text" id="name" name="name">
          <br>
          <label for="email">Email:</label>
          <input type="email" id="email" name="email">
          <br>
          <button type="submit">Submit</button>
        </form>
    
        <?php
        if (isset($_POST['name']) && isset($_POST['email'])) {
          $name = $_POST['name'];
          $email = $_POST['email'];
          echo "<p>Hello, $name! Your email is $email.</p>";
        }
        ?>
      </body>
    </html>
    

    แบบส่งค่าไปอีกหน้า

    <form method="post" action="process.php">
      <label for="slider">Select a value:</label>
      <input type="range" id="slider" name="slider" min="500000" max="1000000" step="1">
      <button type="submit">Submit</button>
    </form>
    
    อีกหน้า
    
    <?php
    $value = $_POST['slider'];
    if ($value >= 500000 && $value <= 699999) {
      $discountedValue = $value * 0.99;
    } elseif ($value >= 700000) {
      $discountedValue = $value * 0.985;
    } else {
      $discountedValue = $value;
    }
    echo "Selected value: " . $value . "<br>";
    echo "Discounted value: " . $discountedValue;
    ?>
    

    ทำให้อยู่ในไฟล์เดียว

    <!DOCTYPE html>
    <html>
      <head>
        <title>Form Example</title>
      </head>
      <body>
        <form method="post" action="">
          <label for="slider">Select a value:</label>
          <input type="range" id="slider" name="slider" min="500000" max="1000000" step="1">
          <button type="submit">Submit</button>
        </form>
    
        <?php
        if (isset($_POST['slider'])) {
          $value = $_POST['slider'];
          if ($value >= 500000 && $value <= 699999) {
            $discountedValue = $value * 0.99;
          } elseif ($value >= 700000) {
            $discountedValue = $value * 0.985;
          } else {
            $discountedValue = $value;
          }
          echo "Selected value: " . $value . "<br>";
          echo "Discounted value: " . $discountedValue;
        }
        ?>
      </body>
    </html>
    

    แสดงค่าขณะ เลื่อน

        <input type="range" id="slider" name="slider" min="500000" max="1000000" step="1">
        <span id="slider-value"></span>
    
        <script>
          const slider = document.getElementById('slider');
          const sliderValue = document.getElementById('slider-value');
    
          slider.addEventListener('input', (event) => {
            sliderValue.textContent = event.target.value;
          });
        </script>

    แสดงค่าทีละ แสน

        <input type="range" id="slider" name="slider" min="500000" max="1000000" step="100000">
        <span id="slider-value"></span>
    
        <script>
          const slider = document.getElementById('slider');
          const sliderValue = document.getElementById('slider-value');
    
          slider.addEventListener('input', (event) => {
            const value = Math.round(event.target.value / 100000) * 100000;
            sliderValue.textContent = value;
          });
        </script>


เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories


Uncategorized