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

  • Home
  • SEARCH
  • 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 5947223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:56:02+00:00 2026-05-22T16:56:02+00:00

so i have a form where people select a drop off time and a

  • 0

so i have a form where people select a drop off time and a pick up time from two separate select option drop down menues.

I cannot figure out how to write the javascript if statement that would not let them hire the particular machine for more than 24 hours, i.e if 7am dropp off is select, pickup MUST be 7am.

i.e if(option 7am dropoff) & (pickup = 8am)
{
err = 0
}

 <td width="248" height="23"><select name="dropoff">


             <option value="07:00am" <?php echo $dropoff=="07:00"?"selected":""?>>07:00am</option>
             <option value="07:30am" <?php echo $dropff=="08:00"?"selected":""?>>07:30am</option>
             <option value="08:00am" <?php echo $dropoff=="09:00"?"selected":""?>>08:00am</option>                      
             <option value="8:30am" <?php echo $dropoff=="10:00"?"selected":""?>>08:30am</option>
             <option value="9:00am" <?php echo $dropoff=="11:00"?"selected":""?>>09:00am</option>
             <option value="09:30am" <?php echo $dropoff=="12:00"?"selected":""?>>09:30am</option>
             <option value="10:00am" <?php echo $dropoff=="12:00"?"selected":""?>>10:00am</option>
             <option value="07:00pm" <?php echo $dropoff=="07:00"?"selected":""?>>07:00pm</option>
             <option value="07:30pm" <?php echo $dropoff=="08:00"?"selected":""?>>07:30pm</option>
             <option value="08:00pm" <?php echo $dropoff=="09:00"?"selected":""?>>08:00pm</option>                      
             <option value="08:30pm" <?php echo $dropoff=="10:00"?"selected":""?>>08:30pm</option>
             <option value="09:00pm" <?php echo $dropoff=="11:00"?"selected":""?>>09:00pm</option>
             <option value="09:30pm" <?php echo $dropoff=="12:00"?"selected":""?>>09:30pm</option>
             <option value="10:00pm"<?php echo $dropoff=="12:00"?"selected":""?>>10:00pm</option>
  </select> 

and

<td width="548" height="23"><select name="pickup">


                 <option value="07:00am" <?php echo $pickup=="07:00"?"selected":""?>>07:00am</option>
                 <option value="07:30am" <?php echo $pickup=="08:00"?"selected":""?>>07:30am</option>
                 <option value="08:00am" <?php echo $pickup=="09:00"?"selected":""?>>08:00am</option>                       
                 <option value="8:30am" <?php echo $pickup=="10:00"?"selected":""?>>08:30am</option>
                 <option value="9:00am" <?php echo $pickup=="11:00"?"selected":""?>>09:00am</option>
                 <option value="09:30am" <?php echo $pickup=="12:00"?"selected":""?>>09:30am</option>
                 <option value="10:00am" <?php echo $pickup=="12:00"?"selected":""?>>10:00am</option>
                 <option value="07:00pm" <?php echo $pickup=="07:00"?"selected":""?>>07:00pm</option>
                 <option value="07:30pm" <?php echo $pickup=="08:00"?"selected":""?>>07:30pm</option>
                 <option value="08:00pm" <?php echo $pickup=="09:00"?"selected":""?>>08:00pm</option>                       
                 <option value="08:30pm" <?php echo $pickup=="10:00"?"selected":""?>>08:30pm</option>
                 <option value="09:00pm" <?php echo $pickup=="11:00"?"selected":""?>>09:00pm</option>
                 <option value="09:30pm" <?php echo $pickup=="12:00"?"selected":""?>>09:30pm</option>
                 <option value="10:00pm"<?php echo $pickup=="12:00"?"selected":""?>>10:00pm</option>
      </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-22T16:56:03+00:00Added an answer on May 22, 2026 at 4:56 pm

    If you’re sure that the second drop down represents the next day then all you have to do is compare the selectedIndex of the two selects and make sure the second one is <= to the first.

    In other words…

    sel1 = forms[0].elements["dropoff"].selectedIndex; //drop down 1
    sel2 = forms[0].elements["pickup"].selectedIndex; //drop down 2 
    
    if(sel2 > sel1){
       //you are asking for more than 24 hours
    }
    

    However, as I said in my comment, what happens if someone wants dropoff at 7am and pickup at 11am (4 ours later)? Do you also have a date picker to specify?

    The easier (and more intuitive approach) would be to set the second drop down for the number of hours and then display the pickup time based on that, like this…

    dropDate = new Date( /* set the date here based on the first drop down */);
    leaseTime = getHoursFrom2ndDropDown();//this should return 1-24 based on second dropdown value
    
    //add milliseconds for leaseTime to the date for your pickupDate
    pickupDate = new Date ( dropDate.getTime() + (1000 * 60 * 60 * leaseTime) ); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a select list drop down in my Rails application, in the form
How can I insert a drop-down value into a DB? I have a form
I have a form with a table that has two input boxes, a select
I have this application that has a form with a drop-down list and a
I have a form which has a select box with name of cities from
I have a form in which people will be entering dollar values. Possible inputs:
I have a form with a list of people with check boxes next to
You have to have a form on your website for people to send an
Let's say I have a form where users can search for people whose name
I have seen people say that it is bad form to use catch with

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.