Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Enable/disable a radio button for certain hour

    Hi,

    I am working on php coding and have no idea how to Enable/disable a radio button for certain hour.

    Here is code for a radio button.
    Code:
    <?php if ($delivery_date_time == "1") { ?>
    <input type="radio" name="delivery_date_time" id="delivery_date_time_input" value="1" checked/>
    <?php } else {?>
    <input type="radio" name="delivery_date_time" id="delivery_date_time_input" value="1"/>
    <?php }
    echo $VM_LANG->_('PHPSHOP_CHECKOUT_DELIVERY_DATE_TIME1') ?><br/>
    I want to enable this code from 0 to 6 am and disable the other hour in every day.

    Thank you for your help!

    Isaac.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    What is $delivery_date_time? Can you post where that is declared?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    PHP Code:
    <?php
    function edt(){
      
    $now localtime(time(),true);
      
    $hour $now['tm_hour'];
      if(
    $hour >= && $hour <= 6){
         return 
    'checked="checked"';
      }
      return 
    '';
    }
    ?>
    <input type="radio" name="delivery_date_time" id="delivery_date_time_input"
               value="1"<?php echo edt(); ?>/>
    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •