Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6179395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:39:20+00:00 2026-05-24T00:39:20+00:00

I have two drop downs one for a punch in and one for a

  • 0

I have two drop downs one for a punch in and one for a punch out. They both are in 24 hour time so they have options from 0-23. Is there a way I can use javascript and php to make the out dropdown start a number greater than the chosen in drop down?

these are chunks of code, dont mind the open and closing of table tags

   <td>Start Time</td>
    <td>
        <select name="hourIn" id="hourIn">
            <option value="" selected></option>
        <? for ($hour=0; $hour <= 23; $hour++): ?>

            <option value="<?=$hour?>"><?=$hour?></option>
        <? endfor ; ?>
        </select>   
   <td>End Time</td>
    <td>
        <select name="hourOut" id="hourOut">
            <option value="" selected></option>
        <? for ($hour=0; $hour <= 23; $hour++): ?>

            <option value="<?=$hour?>"><?=$hour?></option>

        <? endfor ; ?>
        </select> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:39:21+00:00Added an answer on May 24, 2026 at 12:39 am

    Yes, with JavaScript:

    <!doctype html>
    <html>
        <head>
            <title>Example</title>
        </head>
    
        <body>
            <form name="myForm" action="#" method="post">
               <select name="checkIn">
                   <!-- options -->
               </select>
    
               <select name="checkOut">
                   <!-- options -->
               </select>
            </form>
        </body>
    
        <script type="text/javascript">
            var checkIn = document.forms["myForm"].elements["checkIn"],
                checkOut = document.forms["myForm"].elements["checkOut"];
    
            checkIn.onclick = function() {
                if (this.value == 23) {
                    checkOut.value = 0;
                }
                else {
                    checkOut.value = this.value + 1;
                }
            }
    
            checkOut.onclick = function() {
                if (this.value <= checkIn.value) {
                    this.value = checkIn.value + 1;
                }
            }
        </script>
    
    </html>
    

    You may need to fiddle with the logic for the edge cases, but that’s the gist of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple page with two drop downs, one for country and one
I have a form with two text boxes, one select drop down and one
I have two sets of drop downs for start date and end date. Each
Imagine you have a website with several drop-downs that are populated from the back-end
Say I have two drop downs which are populated when the my jsp loads
There will be two drop down lists, First have the list of mobile vendor,
I have a asp:GridView and in there i have two columns , in one
I search and get 10 records as result.I have two drop down boxes.one will
I have two Drop Down Lists, the second ones are based off which one
I have a table with two large cells, the left cell containing two drop-downs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.